Commit e8b4275a authored by Stefan Behnel's avatar Stefan Behnel

simplify search for duplicate values in SwitchTransform and make it safer for...

simplify search for duplicate values in SwitchTransform and make it safer for unexpected value nodes
parent 1c36f361
......@@ -874,7 +874,12 @@ class SwitchTransform(Visitor.VisitorTransform):
else:
# this isn't completely safe as we don't know the
# final C value, but this is about the best we can do
seen.add(getattr(getattr(value, 'entry', None), 'cname'))
try:
if value.entry.cname in seen:
return True
except AttributeError:
return True # play safe
seen.add(value.entry.cname)
return False
def visit_IfStatNode(self, node):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment