Repository navigation
Commit a1732ba
* fix(transform): preserve per-iteration let/const bindings across the async state machine (#6345)
The async/generator lowering hoisted every body Let into one
activation-wide PreallocateBoxes frame, collapsing a loop's per-iteration
let/const onto a single box: every closure made in the loop observed the
last value. Only hoist bindings that must survive a suspend.
* fix(transform): snapshot per-iteration captures that outlive an await (#6345)
A binding read after an await keeps its cross-state box, which is shared
by every iteration. Copy it into a per-state local at each closure-creation
site so each closure gets its own binding. Gated to captures HIR marks
read-only (captures minus mutable_captures), with a rollback verifier.
* fix(transform): analyze labeled loops for per-iteration bindings (#6345)
Stmt::Labeled wraps the loop, so a bare Stmt::For match skipped every
labeled loop and each_child_stmt_list unwrapped straight to its body —
the loop statement itself was never analyzed.
* test(gap): per-iteration loop binding regression fixture (#6345)
Covers const/loop-var capture, await before/after the capture, while,
do-while, for-of, for-in, for-await-of, nested loops, labeled loops,
try/catch/finally, switch, array + destructured bindings, nested closures,
sync generators, var (function-scoped, last value), closure-written and
outer-written bindings, and a non-async control.
---------
Co-authored-by: Ralph Küpper <ralph@skelpo.com>
1 parent 7310e56 commit a1732ba
6 files changed
Lines changed: 1108 additions & 6 deletions
File tree
- crates/perry-transform/src
- generator
- unroll
- test-files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
142 | 153 | | |
143 | 154 | | |
144 | 155 | | |
| |||
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
226 | | - | |
227 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
228 | 254 | | |
229 | 255 | | |
230 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
0 commit comments