sim: support Case
This commit is contained in:
parent
9d3fd50950
commit
ec1d4edf84
|
@ -130,8 +130,15 @@ class Evaluator:
|
||||||
self.execute(s.t)
|
self.execute(s.t)
|
||||||
else:
|
else:
|
||||||
self.execute(s.f)
|
self.execute(s.f)
|
||||||
|
elif isinstance(s, Case):
|
||||||
|
test = self.eval(s.test)
|
||||||
|
for k, v in s.cases.items():
|
||||||
|
if isinstance(k, Constant) and k.value == test:
|
||||||
|
self.execute(v)
|
||||||
|
return
|
||||||
|
if "default" in s.cases:
|
||||||
|
self.execute(s.cases["default"])
|
||||||
else:
|
else:
|
||||||
# TODO: Case
|
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue