Commit fac68977 authored by Stefan Behnel's avatar Stefan Behnel

Simplify some code.

parent 6260f487
...@@ -6337,10 +6337,10 @@ class SwitchCaseNode(StatNode): ...@@ -6337,10 +6337,10 @@ class SwitchCaseNode(StatNode):
def generate_execution_code(self, code): def generate_execution_code(self, code):
num_conditions = len(self.conditions) num_conditions = len(self.conditions)
line_tracing_enabled = code.globalstate.directives['linetrace'] line_tracing_enabled = code.globalstate.directives['linetrace']
for i, cond in enumerate(self.conditions): for i, cond in enumerate(self.conditions, 1):
code.putln("case %s:" % cond.result()) code.putln("case %s:" % cond.result())
code.mark_pos(cond.pos) # Tracing code must appear *after* the 'case' statement. code.mark_pos(cond.pos) # Tracing code must appear *after* the 'case' statement.
if line_tracing_enabled and i + 1 < num_conditions: if line_tracing_enabled and i < num_conditions:
# Allow fall-through after the line tracing code. # Allow fall-through after the line tracing code.
code.putln('CYTHON_FALLTHROUGH;') code.putln('CYTHON_FALLTHROUGH;')
self.body.generate_execution_code(code) self.body.generate_execution_code(code)
......
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