Commit cde600a1 authored by Stefan Behnel's avatar Stefan Behnel

fix FlattenInListTransform for the trivial case

parent d304d225
......@@ -114,7 +114,7 @@ class Context:
_specific_post_parse,
InterpretCompilerDirectives(self, self.pragma_overrides),
_align_function_definitions,
# FlattenInListTransform(),
FlattenInListTransform(),
WithTransform(self),
DecoratorTransform(self),
AnalyseDeclarationsTransform(self),
......
......@@ -311,8 +311,13 @@ class FlattenInListTransform(Visitor.VisitorTransform):
args = node.operand2.args
if len(args) == 0:
return ExprNodes.BoolNode(pos = node.pos, value = node.operator == 'not_in')
if node.operand1.is_temp or node.operand1.is_simple():
lhs = node.operand1
else:
lhs = ExprNodes.PersistentNode(node.operand1, len(args))
# FIXME: allocate temp for evaluated node.operand1
return node
conds = []
for arg in args:
cond = ExprNodes.PrimaryCmpNode(
......@@ -331,6 +336,7 @@ class FlattenInListTransform(Visitor.VisitorTransform):
operator = conjunction,
operand1 = left,
operand2 = right)
return reduce(concat, conds)
else:
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