Skip to content

Commit 81c16cd

Browse files
Fix Promise.all with async orders and Go struct alignment
- Fix TsRunOrder struct size in Go wazero wrapper (16 bytes, not 12) to account for u64 alignment padding on wasm32 - Handle PendingOrder markers in Promise.all by converting them to order-linked promises that resolve when orders are fulfilled - Add order_promises tracking in Interpreter for automatic promise resolution on order fulfillment - Fix declare function grammar to be a no-op (ambient declarations) - Update C examples and WASM playground for consistency Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0953b0f commit 81c16cd

File tree

19 files changed

+568
-401
lines changed

19 files changed

+568
-401
lines changed

examples/c-embedding/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ Demonstrates fundamental operations:
5959
TsRunContext* ctx = tsrun_new();
6060

6161
TsRunResult prep = tsrun_prepare(ctx, "1 + 2 * 3", NULL);
62-
TsRunStepResult result = tsrun_run(ctx);
62+
TsRunStepResult result;
63+
tsrun_run(&result, ctx);
6364

6465
if (result.status == TSRUN_STEP_COMPLETE) {
6566
printf("Result: %f\n", tsrun_get_number(result.value));
@@ -101,7 +102,8 @@ Demonstrates handling ES module imports:
101102
- Accessing module exports from C
102103

103104
```c
104-
TsRunStepResult result = tsrun_run(ctx);
105+
TsRunStepResult result;
106+
tsrun_run(&result, ctx);
105107

106108
while (result.status == TSRUN_STEP_NEED_IMPORTS) {
107109
for (size_t i = 0; i < result.import_count; i++) {
@@ -110,7 +112,7 @@ while (result.status == TSRUN_STEP_NEED_IMPORTS) {
110112
tsrun_provide_module(ctx, path, source);
111113
}
112114
tsrun_step_result_free(&result);
113-
result = tsrun_run(ctx);
115+
tsrun_run(&result, ctx);
114116
}
115117
```
116118
@@ -130,7 +132,8 @@ while (result.status == TSRUN_STEP_SUSPENDED) {
130132
// Create response...
131133
}
132134
tsrun_fulfill_orders(ctx, responses, count);
133-
result = tsrun_run(ctx);
135+
tsrun_step_result_free(&result);
136+
tsrun_run(&result, ctx);
134137
}
135138
```
136139

0 commit comments

Comments
 (0)