Skip to content

Commit f3a5362

Browse files
committed
Update remaining call sites
1 parent 2ec689d commit f3a5362

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

mypyc/irbuild/function.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ def handle_ext_method(builder: IRBuilder, cdef: ClassDef, fdef: FuncDef) -> None
433433

434434
# Set the callable object representing the decorated method as an attribute of the
435435
# extension class.
436-
builder.primitive_op(py_setattr_op, [typ, builder.load_str(name), decorated_func], fdef.line)
436+
builder.primitive_op(
437+
py_setattr_op, [typ, builder.load_str(name), decorated_func], fdef.line
438+
)
437439

438440
if fdef.is_property:
439441
# If there is a property setter, it will be processed after the getter,

mypyc/irbuild/ll_builder.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def py_get_attr(self, obj: Value, attr: str, line: int) -> Value:
620620
Prefer get_attr() which generates optimized code for native classes.
621621
"""
622622
key = self.load_str(attr)
623-
return self.call_c(py_getattr_op, [obj, key], line)
623+
return self.primitive_op(py_getattr_op, [obj, key], line)
624624

625625
# isinstance() checks
626626

@@ -656,7 +656,9 @@ def isinstance_native(self, obj: Value, class_ir: ClassIR, line: int) -> Value:
656656
"""
657657
concrete = all_concrete_classes(class_ir)
658658
if concrete is None or len(concrete) > FAST_ISINSTANCE_MAX_SUBCLASSES + 1:
659-
return self.call_c(fast_isinstance_op, [obj, self.get_native_type(class_ir)], line)
659+
return self.primitive_op(
660+
fast_isinstance_op, [obj, self.get_native_type(class_ir)], line
661+
)
660662
if not concrete:
661663
# There can't be any concrete instance that matches this.
662664
return self.false()
@@ -857,7 +859,7 @@ def _construct_varargs(
857859
if star_result is None:
858860
star_result = self.new_tuple(star_values, line)
859861
else:
860-
star_result = self.call_c(list_tuple_op, [star_result], line)
862+
star_result = self.primitive_op(list_tuple_op, [star_result], line)
861863
if has_star2 and star2_result is None:
862864
star2_result = self._create_dict(star2_keys, star2_values, line)
863865

@@ -1515,7 +1517,7 @@ def compare_tuples(self, lhs: Value, rhs: Value, op: str, line: int = -1) -> Val
15151517
# Cast to bool if necessary since most types uses comparison returning a object type
15161518
# See generic_ops.py for more information
15171519
if not is_bool_rprimitive(compare.type):
1518-
compare = self.call_c(bool_op, [compare], line)
1520+
compare = self.primitive_op(bool_op, [compare], line)
15191521
if i < len(lhs.type.types) - 1:
15201522
branch = Branch(compare, early_stop, check_blocks[i + 1], Branch.BOOL)
15211523
else:
@@ -1534,7 +1536,7 @@ def compare_tuples(self, lhs: Value, rhs: Value, op: str, line: int = -1) -> Val
15341536
def translate_instance_contains(self, inst: Value, item: Value, op: str, line: int) -> Value:
15351537
res = self.gen_method_call(inst, "__contains__", [item], None, line)
15361538
if not is_bool_rprimitive(res.type):
1537-
res = self.call_c(bool_op, [res], line)
1539+
res = self.primitive_op(bool_op, [res], line)
15381540
if op == "not in":
15391541
res = self.bool_bitwise_op(res, Integer(1, rtype=bool_rprimitive), "^", line)
15401542
return res
@@ -1667,7 +1669,7 @@ def new_list_op(self, values: list[Value], line: int) -> Value:
16671669
return result_list
16681670

16691671
def new_set_op(self, values: list[Value], line: int) -> Value:
1670-
return self.call_c(new_set_op, values, line)
1672+
return self.primitive_op(new_set_op, values, line)
16711673

16721674
def setup_rarray(
16731675
self, item_type: RType, values: Sequence[Value], *, object_ptr: bool = False
@@ -1775,7 +1777,7 @@ def bool_value(self, value: Value) -> Value:
17751777
self.goto(end)
17761778
self.activate_block(end)
17771779
else:
1778-
result = self.call_c(bool_op, [value], value.line)
1780+
result = self.primitive_op(bool_op, [value], value.line)
17791781
return result
17801782

17811783
def add_bool_branch(self, value: Value, true: BasicBlock, false: BasicBlock) -> None:
@@ -2065,7 +2067,7 @@ def float_mod(self, lhs: Value, rhs: Value, line: int) -> Value:
20652067
self.activate_block(copysign)
20662068
# If the remainder is zero, CPython ensures the result has the
20672069
# same sign as the denominator.
2068-
adj = self.call_c(copysign_op, [Float(0.0), rhs], line)
2070+
adj = self.primitive_op(copysign_op, [Float(0.0), rhs], line)
20692071
self.add(Assign(res, adj))
20702072
self.add(Goto(done))
20712073
self.activate_block(done)
@@ -2260,7 +2262,7 @@ def new_tuple_with_length(self, length: Value, line: int) -> Value:
22602262
return self.call_c(new_tuple_with_length_op, [length], line)
22612263

22622264
def int_to_float(self, n: Value, line: int) -> Value:
2263-
return self.call_c(int_to_float_op, [n], line)
2265+
return self.primitive_op(int_to_float_op, [n], line)
22642266

22652267
# Internal helpers
22662268

0 commit comments

Comments
 (0)