fix(wasm): remove spurious i32.const from uncompiled assignment placeholders
Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 4s
Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 4s
Undcompiled map/record/unrecognized assignments emitted (i32.const 1) placeholders that left values on the WASM stack. Combined with the default return i32.const 1 at end of function, this caused type mismatch errors (expected [], got [i32, i32] or [i32]). Fix: make uncompiled assignments emit comment-only output with no stack effect. Scalar assignments already work correctly since emitExpr feeds into global.set which consumes the value. Closes #9 WASM E2E portion — parser fix for precondition:/postcondition: keyword handling still needed.
This commit is contained in:
parent
a2f7b7b2e9
commit
acb464f957
1 changed files with 3 additions and 5 deletions
|
|
@ -357,18 +357,16 @@ function emitAssignment(
|
||||||
const keyExpr = mapAssign[2];
|
const keyExpr = mapAssign[2];
|
||||||
// For now: map_set(map_handle, key_handle, value_handle)
|
// For now: map_set(map_handle, key_handle, value_handle)
|
||||||
// This needs boxing; simplified version just marks as stub
|
// This needs boxing; simplified version just marks as stub
|
||||||
return `;; Map assignment not yet compiled: ${target} := ${expr}\n` +
|
return `;; Map assignment not yet compiled: ${target} := ${expr}`;
|
||||||
` (i32.const 1)`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record field assignment: accounts[id].field := expr
|
// Record field assignment: accounts[id].field := expr
|
||||||
const recordAssign = target.match(/^(\w+)\[(.+)\]\.(\w+)$/);
|
const recordAssign = target.match(/^(\w+)\[(.+)\]\.(\w+)$/);
|
||||||
if (recordAssign && maps.has(recordAssign[1])) {
|
if (recordAssign && maps.has(recordAssign[1])) {
|
||||||
return `;; Record field assignment not yet compiled: ${target} := ${expr}\n` +
|
return `;; Record field assignment not yet compiled: ${target} := ${expr}`;
|
||||||
` (i32.const 1)`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return `;; Unrecognized assignment target: ${target}\n (i32.const 1)`;
|
return `;; Unrecognized assignment target: ${target}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue