fhdl/structure: all case statements should be lists

This commit is contained in:
Sebastien Bourdeauducq 2015-09-17 17:22:24 +08:00
parent bcf62997f6
commit 776579f0d7
1 changed files with 2 additions and 0 deletions

View File

@ -547,6 +547,8 @@ class Case(_Statement):
if (not isinstance(k, Constant)
and not (isinstance(k, str) and k == "default")):
raise TypeError("Case object is not a Migen constant")
if not isinstance(v, _collections.Iterable):
v = [v]
if not _check_statement(v):
raise TypeError("Not all objects for case {} "
"are Migen statements".format(k))