Commit ee47fe6
committed
v3/wasm: resolve import aliases, fix loop post scope
Address PR review:
- Import aliases: `import moda as m; m.answer()` keyed the call as
m.answer, but candidates are keyed from the module declaration
(moda.answer), so the call hit the i32.const 0 fallback. Collect
`import mod as alias` mappings (import_decl.value/.typ) and map the
selector base back to the real module when resolving call keys.
- C-style for post scope: the loop snapshot was only restored after the
post statement, so a body-local that shadowed the loop variable was
still bound when the post was emitted (e.g. `for ; i < 1; i++ { i := 10 }`
incremented the inner local and never advanced the loop). Snapshot the
bindings after the initializer and restore them before emitting the
post so it rebinds to the loop variable.
Also handle blank assignments (`_ = expr`) by evaluating the rhs for
side effects and dropping it, instead of warning.
Adds regression tests for both review items.1 parent 0390c1a commit ee47fe6
2 files changed
Lines changed: 62 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
505 | 507 | | |
506 | 508 | | |
507 | 509 | | |
508 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
509 | 517 | | |
510 | 518 | | |
511 | 519 | | |
| |||
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
595 | 606 | | |
596 | 607 | | |
597 | 608 | | |
| |||
611 | 622 | | |
612 | 623 | | |
613 | 624 | | |
| 625 | + | |
| 626 | + | |
614 | 627 | | |
615 | 628 | | |
616 | 629 | | |
| |||
938 | 951 | | |
939 | 952 | | |
940 | 953 | | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
941 | 964 | | |
942 | 965 | | |
943 | 966 | | |
944 | | - | |
| 967 | + | |
| 968 | + | |
945 | 969 | | |
946 | 970 | | |
947 | 971 | | |
| |||
952 | 976 | | |
953 | 977 | | |
954 | 978 | | |
955 | | - | |
| 979 | + | |
| 980 | + | |
956 | 981 | | |
957 | 982 | | |
958 | 983 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
271 | 302 | | |
272 | 303 | | |
273 | 304 | | |
| |||
0 commit comments