Commit 9470a79b authored by Stefan Behnel's avatar Stefan Behnel

Minor code reformatting.

parent cb440212
...@@ -1192,9 +1192,9 @@ class SwitchTransform(Visitor.EnvTransform): ...@@ -1192,9 +1192,9 @@ class SwitchTransform(Visitor.EnvTransform):
if common_var is None: if common_var is None:
self.visitchildren(node) self.visitchildren(node)
return node return node
cases.append(Nodes.SwitchCaseNode(pos = if_clause.pos, cases.append(Nodes.SwitchCaseNode(pos=if_clause.pos,
conditions = conditions, conditions=conditions,
body = if_clause.body)) body=if_clause.body))
condition_values = [ condition_values = [
cond for case in cases for cond in case.conditions] cond for case in cases for cond in case.conditions]
...@@ -1206,10 +1206,10 @@ class SwitchTransform(Visitor.EnvTransform): ...@@ -1206,10 +1206,10 @@ class SwitchTransform(Visitor.EnvTransform):
return node return node
common_var = unwrap_node(common_var) common_var = unwrap_node(common_var)
switch_node = Nodes.SwitchStatNode(pos = node.pos, switch_node = Nodes.SwitchStatNode(pos=node.pos,
test = common_var, test=common_var,
cases = cases, cases=cases,
else_clause = node.else_clause) else_clause=node.else_clause)
return switch_node return switch_node
def visit_CondExprNode(self, node): def visit_CondExprNode(self, node):
...@@ -1220,10 +1220,11 @@ class SwitchTransform(Visitor.EnvTransform): ...@@ -1220,10 +1220,11 @@ class SwitchTransform(Visitor.EnvTransform):
not_in, common_var, conditions = self.extract_common_conditions( not_in, common_var, conditions = self.extract_common_conditions(
None, node.test, True) None, node.test, True)
if common_var is None \ if common_var is None \
or len(conditions) < 2 \ or len(conditions) < 2 \
or self.has_duplicate_values(conditions): or self.has_duplicate_values(conditions):
self.visitchildren(node) self.visitchildren(node)
return node return node
return self.build_simple_switch_statement( return self.build_simple_switch_statement(
node, common_var, conditions, not_in, node, common_var, conditions, not_in,
node.true_val, node.false_val) node.true_val, node.false_val)
...@@ -1236,8 +1237,8 @@ class SwitchTransform(Visitor.EnvTransform): ...@@ -1236,8 +1237,8 @@ class SwitchTransform(Visitor.EnvTransform):
not_in, common_var, conditions = self.extract_common_conditions( not_in, common_var, conditions = self.extract_common_conditions(
None, node, True) None, node, True)
if common_var is None \ if common_var is None \
or len(conditions) < 2 \ or len(conditions) < 2 \
or self.has_duplicate_values(conditions): or self.has_duplicate_values(conditions):
self.visitchildren(node) self.visitchildren(node)
node.wrap_operands(self.current_env()) # in case we changed the operands node.wrap_operands(self.current_env()) # in case we changed the operands
return node return node
...@@ -1255,8 +1256,8 @@ class SwitchTransform(Visitor.EnvTransform): ...@@ -1255,8 +1256,8 @@ class SwitchTransform(Visitor.EnvTransform):
not_in, common_var, conditions = self.extract_common_conditions( not_in, common_var, conditions = self.extract_common_conditions(
None, node, True) None, node, True)
if common_var is None \ if common_var is None \
or len(conditions) < 2 \ or len(conditions) < 2 \
or self.has_duplicate_values(conditions): or self.has_duplicate_values(conditions):
self.visitchildren(node) self.visitchildren(node)
return node return 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