fhdl.ast: fix Switch._?hs_signals() for switch without statements.
authorwhitequark <whitequark@whitequark.org>
Thu, 13 Dec 2018 05:00:44 +0000 (05:00 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 13 Dec 2018 05:00:44 +0000 (05:00 +0000)
nmigen/fhdl/ast.py

index 123e2aedc40e3b5d6c1ff284fa05dc04c0c91ed1..2e1942b1afaba0746a0235490a89c45bbc234ac8 100644 (file)
@@ -649,10 +649,11 @@ class Switch(Statement):
             self.cases[key] = Statement.wrap(stmts)
 
     def _lhs_signals(self):
-        return union(s._lhs_signals() for ss in self.cases.values() for s in ss )
+        signals = union(s._lhs_signals() for ss in self.cases.values() for s in ss) or ValueSet()
+        return signals
 
     def _rhs_signals(self):
-        signals = union(s._rhs_signals() for ss in self.cases.values() for s in ss)
+        signals = union(s._rhs_signals() for ss in self.cases.values() for s in ss) or ValueSet()
         return self.test._rhs_signals() | signals
 
     def __repr__(self):