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

Method gen_condition

mypyc/irbuild/for_helpers.py:1138–1146  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1136 builder.assign(self.index_target, builder.read(self.index_reg, self.line), self.line)
1137
1138 def gen_condition(self) -> None:
1139 builder = self.builder
1140 line = self.line
1141 # Add loop condition check.
1142 cmp = "<" if self.step > 0 else ">"
1143 comparison = builder.binary_op(
1144 builder.read(self.index_reg, line), builder.read(self.end_target, line), cmp, line
1145 )
1146 builder.add_bool_branch(comparison, self.body_block, self.loop_exit)
1147
1148 def begin_body(self) -> None:
1149 # Update the user-visible loop variable at the start of the body,

Callers

nothing calls this directly

Calls 3

binary_opMethod · 0.45
readMethod · 0.45
add_bool_branchMethod · 0.45

Tested by

no test coverage detected