From: whitequark Date: Wed, 3 Jul 2019 13:19:15 +0000 (+0000) Subject: compat.fhdl.structure: fix If/Elif/Else after 32446831. X-Git-Tag: locally_working~123 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9eb81609d65eb6d1421806b75cf77996a2165096;p=nmigen.git compat.fhdl.structure: fix If/Elif/Else after 32446831. --- diff --git a/nmigen/compat/fhdl/structure.py b/nmigen/compat/fhdl/structure.py index 26b1d34..c56a89f 100644 --- a/nmigen/compat/fhdl/structure.py +++ b/nmigen/compat/fhdl/structure.py @@ -55,21 +55,21 @@ class If(ast.Switch): cond = Value.wrap(cond) if len(cond) != 1: cond = cond.bool() - super().__init__(cond, {"1": ast.Statement.wrap(stmts)}) + super().__init__(cond, {("1",): ast.Statement.wrap(stmts)}) @deprecated("instead of `.Elif(cond, ...)`, use `with m.Elif(cond): ...`") def Elif(self, cond, *stmts): cond = Value.wrap(cond) if len(cond) != 1: cond = cond.bool() - self.cases = OrderedDict(("-" + k, v) for k, v in self.cases.items()) - self.cases["1" + "-" * len(self.test)] = ast.Statement.wrap(stmts) + self.cases = OrderedDict((("-" + k,), v) for (k,), v in self.cases.items()) + self.cases[("1" + "-" * len(self.test),)] = ast.Statement.wrap(stmts) self.test = Cat(self.test, cond) return self @deprecated("instead of `.Else(...)`, use `with m.Else(): ...`") def Else(self, *stmts): - self.cases["-" * len(self.test)] = ast.Statement.wrap(stmts) + self.cases[()] = ast.Statement.wrap(stmts) return self