Commit f277fa1f authored by Stefan Behnel's avatar Stefan Behnel

conservative fix for empty switch statements

parent 859db279
......@@ -3469,6 +3469,7 @@ class SwitchStatNode(StatNode):
if self.else_clause is not None:
code.putln("default:")
self.else_clause.generate_execution_code(code)
code.putln("break;")
code.putln("}")
def annotate(self, code):
......
......@@ -89,6 +89,9 @@ __doc__ = u"""
1
>>> switch_off(2)
0
>>> switch_pass(1)
1
"""
def switch_simple_py(x):
......@@ -173,3 +176,12 @@ def switch_off(int x):
else:
return 0
return -1
def switch_pass(int x):
if x == 1:
pass
elif x == 2:
pass
else:
pass
return x
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