fhdl.ast: fix Switch with constant test.
This commit is contained in:
parent
a0d555a9fc
commit
50ba443f92
2 changed files with 16 additions and 2 deletions
|
|
@ -678,9 +678,9 @@ class Switch(Statement):
|
|||
self.cases = OrderedDict()
|
||||
for key, stmts in cases.items():
|
||||
if isinstance(key, (bool, int)):
|
||||
key = "{:0{}b}".format(key, len(test))
|
||||
key = "{:0{}b}".format(key, len(self.test))
|
||||
elif isinstance(key, str):
|
||||
assert len(key) == len(test)
|
||||
assert len(key) == len(self.test)
|
||||
else:
|
||||
raise TypeError
|
||||
if not isinstance(stmts, Iterable):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue