MCPcopy Index your code
hub / github.com/python/mypy / begin_for

Method begin_for

mypyc/irbuild/ll_builder.py:3011–3031  ·  view source on GitHub ↗

Generate for loop over a pointer or native int range. Roughly corresponds to "for i in range(start, end, step): ....". Only positive values for step are supported. The loop index register is generated automatically and is available via the return value. Do not modif

(self, start: Value, end: Value, step: Value, *, signed: bool)

Source from the content-addressed store, hash-verified

3009 # Loop helpers
3010
3011 def begin_for(self, start: Value, end: Value, step: Value, *, signed: bool) -> ForBuilder:
3012 """Generate for loop over a pointer or native int range.
3013
3014 Roughly corresponds to "for i in range(start, end, step): ....". Only
3015 positive values for step are supported.
3016
3017 The loop index register is generated automatically and is available
3018 via the return value. Do not modify it!
3019
3020 Example usage that clears a memory area:
3021
3022 for_loop = builder.begin_for(start_ptr, end_ptr, int32_rprimitive.size)
3023
3024 # For loop body
3025 builder.set_mem(for_loop.index, int32_rprimitive, Integer(0, int32_rprimitive))
3026
3027 for_loop.finish()
3028 """
3029 b = ForBuilder(self, start, end, step, signed=signed)
3030 b.begin()
3031 return b
3032
3033 def error(self, msg: str, line: int) -> None:
3034 assert self.errors is not None, "cannot generate errors in this compiler phase"

Callers 2

vec_create_initializedFunction · 0.80
vec_containsFunction · 0.80

Calls 2

beginMethod · 0.95
ForBuilderClass · 0.85

Tested by

no test coverage detected