Bug description
Root cause.
When makeCallIndirect, parameters are executed before function address calculation, it leads to parameters overwrite the value of fn.
Steps to reproduce
Code
function logA(x: i32):void {
trace(`A: ${x}`);
}
function logB(x: i32):void {
trace(`B: ${x}`);
}
let fn = logA;
function foo(x: i32):i32 {
fn = logB;
return x;
}
fn(foo(42));
Expected behavior
In typescript, the output is A: 42
Observed behavior
In assemblyscript, the output is B: 42
AssemblyScript version
v0.28.9
Bug description
Root cause.
When
makeCallIndirect, parameters are executed before function address calculation, it leads to parameters overwrite the value offn.Steps to reproduce
Code
Expected behavior
In typescript, the output is
A: 42Observed behavior
In assemblyscript, the output is
B: 42AssemblyScript version
v0.28.9