@@ -1075,7 +1075,7 @@ def to_yaml(scfg: "SCFG") -> str:
10751075 return ys
10761076
10771077 @staticmethod
1078- def to_dict (scfg : "SCFG" ) -> Dict [str , Dict [str , BasicBlock ]]:
1078+ def to_dict (scfg : "SCFG" ) -> Dict [str , Dict [str , Any ]]:
10791079 """Helper method to convert the SCFG object to a dictionary
10801080 representation.
10811081
@@ -1109,7 +1109,8 @@ def reverse_lookup(value: type) -> str:
11091109 # Order of elements doesn't matter since they're going to
11101110 # be sorted at the end.
11111111 graph_dict = {}
1112- q .update (set (scfg .graph .keys ()))
1112+ all_keys : set [str ] = set (scfg .graph .keys ())
1113+ q .update (all_keys )
11131114 graph_dict .update (scfg .graph )
11141115
11151116 while q :
@@ -1119,18 +1120,20 @@ def reverse_lookup(value: type) -> str:
11191120 continue
11201121 seen .add (key )
11211122
1122- block_type = reverse_lookup (type (value ))
1123+ block_type : str = reverse_lookup (type (value ))
11231124 blocks [key ] = {"type" : block_type }
11241125 if isinstance (value , RegionBlock ):
1125- q .update (value .subregion .graph .keys ())
1126- graph_dict .update (value .subregion .graph )
1126+ inner_graph = value .subregion .graph # type: ignore
1127+ q .update (inner_graph .keys ())
1128+ graph_dict .update (inner_graph )
11271129 blocks [key ]["kind" ] = value .kind
11281130 blocks [key ]["contains" ] = sorted (
1129- [idx .name for idx in value . subregion . graph .values ()]
1131+ [idx .name for idx in inner_graph .values ()]
11301132 )
11311133 blocks [key ]["header" ] = value .header
11321134 blocks [key ]["exiting" ] = value .exiting
1133- blocks [key ]["parent_region" ] = value .parent_region .name
1135+ parent_name = value .parent_region .name # type: ignore
1136+ blocks [key ]["parent_region" ] = parent_name
11341137 elif isinstance (value , SyntheticBranch ):
11351138 blocks [key ]["branch_value_table" ] = value .branch_value_table
11361139 blocks [key ]["variable" ] = value .variable
@@ -1142,9 +1145,13 @@ def reverse_lookup(value: type) -> str:
11421145 edges [key ] = sorted ([i for i in value ._jump_targets ])
11431146 backedges [key ] = sorted ([i for i in value .backedges ])
11441147
1145- graph_dict = {"blocks" : blocks , "edges" : edges , "backedges" : backedges }
1148+ graph_dict = {
1149+ "blocks" : blocks , # type: ignore
1150+ "edges" : edges , # type: ignore
1151+ "backedges" : backedges , # type: ignore
1152+ }
11461153
1147- return graph_dict
1154+ return graph_dict # type: ignore
11481155
11491156 @staticmethod
11501157 def find_outer_graph (graph_dict : Dict [str , Dict [str , Any ]]) -> Set [str ]:
@@ -1179,7 +1186,7 @@ def extract_block_info(
11791186 block_ref_dict : Dict [str , str ],
11801187 edges : Dict [str , List [str ]],
11811188 backedges : Dict [str , List [str ]],
1182- ) -> Tuple [Dict [str , Any ], str , Tuple [str , ... ], Tuple [str , ... ]]:
1189+ ) -> Tuple [Dict [str , Any ], str , list [str ], list [str ]]:
11831190 """Helper method to extract information from various components of
11841191 an `SCFG` graph.
11851192
0 commit comments