Skip to content

Commit 8b6aaa4

Browse files
[mypyc] feat: support constant folding in transform_assignment_expr
We can't yet fold the expression itself, but we can fold its value expr This PR implements folding for the value expr
1 parent 1b8841b commit 8b6aaa4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypyc/irbuild/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def transform_generator_expr(builder: IRBuilder, o: GeneratorExpr) -> Value:
10971097

10981098

10991099
def transform_assignment_expr(builder: IRBuilder, o: AssignmentExpr) -> Value:
1100-
value = builder.accept(o.value)
1100+
value = try_constant_fold(builder, o.value) or builder.accept(o.value)
11011101
target = builder.get_assignment_target(o.target)
11021102
builder.assign(target, value, o.line)
11031103
return value

0 commit comments

Comments
 (0)