Skip to content

Commit

Permalink
tracer: cover more CALL_* opcodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanda-phi authored and whitequark committed Apr 2, 2024
1 parent 4af9fed commit 08ec36f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion amaranth/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_var_name(depth=2, default=_raise_exception):
else:
break
if call_opc not in ("CALL_FUNCTION", "CALL_FUNCTION_KW", "CALL_FUNCTION_EX",
"CALL_METHOD", "CALL", "CALL_KW"):
"CALL_METHOD", "CALL_METHOD_KW", "CALL", "CALL_KW"):
if default is _raise_exception:
raise NameNotFound
else:
Expand Down
17 changes: 17 additions & 0 deletions tests/test_tracer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from amaranth.hdl.ast import *
from amaranth.hdl import ast
from types import SimpleNamespace

from .utils import *
Expand All @@ -10,6 +11,22 @@ def test_fast(self):
s2 = Signal()
self.assertEqual(s2.name, "s2")

def test_call_variants(self):
args = []
kwargs = {}
s1 = Signal()
self.assertEqual(s1.name, "s1")
s2 = Signal(reset=0)
self.assertEqual(s2.name, "s2")
s3 = Signal(*args, **kwargs)
self.assertEqual(s3.name, "s3")
s4 = ast.Signal()
self.assertEqual(s4.name, "s4")
s5 = ast.Signal(reset=0)
self.assertEqual(s5.name, "s5")
s6 = ast.Signal(*args, **kwargs)
self.assertEqual(s6.name, "s6")

def test_name(self):
class Dummy:
s1 = Signal()
Expand Down

0 comments on commit 08ec36f

Please sign in to comment.