Skip to content

Commit b597b08

Browse files
committed
fix: Complete async state machine support for await in loops
- Fix promise pointer clearing after await completion to prevent reusing stale promises in subsequent loop iterations - Add phi node result capturing for proper loop variable persistence across state transitions - Fix multi-block capture analysis to handle loops without await points - Extend mutable local capturing for multi-block functions The key fixes: 1. Clear promise pointer in ready block (offset to null) so next loop iteration creates a new promise 2. Capture all phi node results as they represent loop variables 3. Don't early-return from analyze_captures for multi-block functions 4. Capture mutable locals for all multi-block functions, not just those with await points Tests now passing: - test_execute_async_with_await_in_loop: sum_doubled(5) = 30 - test_execute_async_count_up: count_up(n) returns n correctly
1 parent 4bd6fad commit b597b08

2 files changed

Lines changed: 2009 additions & 324 deletions

File tree

0 commit comments

Comments
 (0)