Commit e5c11051 authored by Robert Bradshaw's avatar Robert Bradshaw

Allow enums in switch statement optimization.

parent c73a9b2d
...@@ -858,7 +858,7 @@ class SwitchTransform(Visitor.VisitorTransform): ...@@ -858,7 +858,7 @@ class SwitchTransform(Visitor.VisitorTransform):
return self.NO_MATCH return self.NO_MATCH
elif common_var is not None and not is_common_value(var, common_var): elif common_var is not None and not is_common_value(var, common_var):
return self.NO_MATCH return self.NO_MATCH
elif not var.type.is_int or sum([not cond.type.is_int for cond in conditions]): elif not (var.type.is_int or var.type.is_enum) or sum([not (cond.type.is_int or cond.type.is_enum) for cond in conditions]):
return self.NO_MATCH return self.NO_MATCH
return not_in, var, conditions return not_in, var, conditions
......
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