Skip to content

Commit

Permalink
fix source map for insert_instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Feb 19, 2025
1 parent 60a7929 commit 1469b18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion tests/unit/compiler/test_source_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def foo(i: uint256):
assert "safemod" in error_map.values()


@pytest.mark.venom_xfail(raises=AssertionError)
def test_error_map_not_overriding_errors():
code = """
@external
Expand Down
10 changes: 8 additions & 2 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ def __repr__(self) -> str:
if self.annotation:
s += f" ; {self.annotation}"

# debug:
# if self.error_msg:
# s += f" ;>>> {self.error_msg}"

return f"{s: <30}"


Expand Down Expand Up @@ -568,8 +572,10 @@ def insert_instruction(self, instruction: IRInstruction, index: Optional[int] =
assert not self.is_terminated, (self, instruction)
index = len(self.instructions)
instruction.parent = self
instruction.ast_source = self.parent.ast_source
instruction.error_msg = self.parent.error_msg
if instruction.ast_source is None:
instruction.ast_source = self.parent.ast_source
if instruction.error_msg is None:
instruction.error_msg = self.parent.error_msg
self.instructions.insert(index, instruction)

def mark_for_removal(self, instruction: IRInstruction) -> None:
Expand Down

0 comments on commit 1469b18

Please sign in to comment.