Skip to content

Commit

Permalink
fixing itertools.chain
Browse files Browse the repository at this point in the history
  • Loading branch information
tutugordillo committed Oct 22, 2024
1 parent 7f85905 commit 7f9476b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/parser/cfg_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def remove_instruction(self, instr_idx: int) -> None:
Removes the instruction at position instr_index, updating the last split instruction if it affects
the last instruction
"""

instr_idx = (len(self._instructions) + instr_idx) % len(self._instructions)
if instr_idx >= len(self._instructions):
raise ValueError("Attempting to remove an instruction index out of bounds")
Expand Down Expand Up @@ -234,7 +235,7 @@ def process_function_calls(self, function_ids):

# Finally, we identify the possible split instruction using the now generated information
if len(self._instructions) > 0 and \
self._instructions[-1].get_op_name() in itertools.chain(split_block, self.function_calls, "JUMP", "JUMPI"):
self._instructions[-1].get_op_name() in itertools.chain(split_block, self.function_calls, ["JUMP","JUMPI"]):
self._split_instruction = self._instructions[-1]

@property
Expand Down Expand Up @@ -412,7 +413,7 @@ def _build_spec_for_sequence(self, instructions, map_instructions: Dict, out_idx
Builds the specification for a sequence of instructions. "map_instructions" is passed as an argument
to reuse declarations from other blocks, as we might have split the corresponding basic block
"""

spec = {}

uninter_functions = []
Expand Down Expand Up @@ -644,7 +645,7 @@ def _include_jump_tag(self, block_spec: Dict, out_idx: int, block_tags_dict: Dic

def build_spec(self, block_tags_dict: Dict, block_tag_idx: int, initial_stack: List[str],
final_stack: List[str]) -> Tuple[Dict[str, Any], int, int]:

map_instructions = {}

out_idx = 0
Expand Down

0 comments on commit 7f9476b

Please sign in to comment.