MCPcopy Create free account
hub / github.com/python/mypy / assign_if_bitmap_unset

Method assign_if_bitmap_unset

mypyc/irbuild/builder.py:575–591  ·  view source on GitHub ↗
(
        self, target: Register, get_val: Callable[[], Value], index: int, line: int
    )

Source from the content-addressed store, hash-verified

573 self.activate_block(body_block)
574
575 def assign_if_bitmap_unset(
576 self, target: Register, get_val: Callable[[], Value], index: int, line: int
577 ) -> None:
578 error_block, body_block = BasicBlock(), BasicBlock()
579 o = self.int_op(
580 bitmap_rprimitive,
581 self.builder.args[-1 - index // BITMAP_BITS],
582 Integer(1 << (index & (BITMAP_BITS - 1)), bitmap_rprimitive),
583 IntOp.AND,
584 line,
585 )
586 b = self.add(ComparisonOp(o, Integer(0, bitmap_rprimitive), ComparisonOp.EQ, line))
587 self.add(Branch(b, error_block, body_block, Branch.BOOL))
588 self.activate_block(error_block)
589 self.add(Assign(target, self.coerce(get_val(), target.type, line)))
590 self.goto(body_block)
591 self.activate_block(body_block)
592
593 def maybe_add_implicit_return(self) -> None:
594 if is_none_rprimitive(self.ret_types[-1]) or is_object_rprimitive(self.ret_types[-1]):

Callers 1

gen_arg_defaultsFunction · 0.80

Calls 10

int_opMethod · 0.95
addMethod · 0.95
activate_blockMethod · 0.95
coerceMethod · 0.95
gotoMethod · 0.95
BasicBlockClass · 0.90
IntegerClass · 0.90
ComparisonOpClass · 0.90
BranchClass · 0.90
AssignClass · 0.90

Tested by

no test coverage detected