David Mak
4481d48709
core: Use C-style for loop logic for iterables
...
Index increment is now performed at the end of the loop body.
2023-09-06 20:09:38 +08:00
David Mak
b4983526bd
core: Remove redundant for.cond BB for iterable loops
...
Simplifies logic for creating basic blocks.
2023-09-06 20:09:37 +08:00
David Mak
b4a9616648
core: Add assertion for when `range` has step of 0
...
Aligns with the behavior in Python.
2023-09-06 20:09:36 +08:00
David Mak
e0de82993f
core: Preserve value of variable shadowed by for loop
...
Previously, the final value of the target expression would be one after
the last element of the loop, which does not match Python's behavior.
This commit fixes this problem while also preserving the last assigned
value of the loop beyond the loop, matching Python's behavior.
2023-09-06 20:09:36 +08:00
David Mak
6805253515
core: Use AST var name for IR name
...
Aids debugging IR.
2023-09-06 20:09:36 +08:00
David Mak
19915bac79
core: Prepend statement type to basic block label names
...
Aids debugging IR.
2023-09-06 20:09:36 +08:00
David Mak
17b4686260
standalone: Adapt loop example to output loop variable
2023-09-06 18:56:45 +08:00