Skip to content

Commit db0039c

Browse files
committed
Refactor
1 parent 7d8f5e5 commit db0039c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

mypyc/irbuild/expression.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -776,27 +776,27 @@ def try_specialize_in_expr(
776776
cmp_op = "!="
777777
out = BasicBlock()
778778
for item in items:
779-
x = transform_basic_comparison(builder, cmp_op, left, item, line)
780-
b = builder.builder.bool_value(x)
781-
nxt = BasicBlock()
779+
cmp = transform_basic_comparison(builder, cmp_op, left, item, line)
780+
bool_val = builder.builder.bool_value(cmp)
781+
next_block = BasicBlock()
782782
if op == "in":
783-
builder.add_bool_branch(b, out, nxt)
783+
builder.add_bool_branch(bool_val, out, next_block)
784784
else:
785-
builder.add_bool_branch(b, nxt, out)
786-
builder.activate_block(nxt)
787-
r = Register(bool_rprimitive)
785+
builder.add_bool_branch(bool_val, next_block, out)
786+
builder.activate_block(next_block)
787+
result = Register(bool_rprimitive)
788788
end = BasicBlock()
789789
if op == "in":
790790
values = builder.false(), builder.true()
791791
else:
792792
values = builder.true(), builder.false()
793-
builder.assign(r, values[0], line)
793+
builder.assign(result, values[0], line)
794794
builder.goto(end)
795795
builder.activate_block(out)
796-
builder.assign(r, values[1], line)
796+
builder.assign(result, values[1], line)
797797
builder.goto(end)
798798
builder.activate_block(end)
799-
return r
799+
return result
800800
# x in [y]/(y) -> x == y
801801
# x not in [y]/(y) -> x != y
802802
elif n_items == 1:

mypyc/test-data/run-lists.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,6 @@ def test_multiply() -> None:
364364
assert l1 == [1, 1, 1]
365365

366366
[case testOperatorInExpression]
367-
from typing import Final
368-
369367
def tuple_in_int0(i: int) -> bool:
370368
return i in []
371369

0 commit comments

Comments
 (0)