wasm: fix generation of constructor invocation

This commit is contained in:
Alexey Andreev 2024-08-02 14:36:33 +02:00
parent 7ba0a7fe7d
commit 8e483245f5

View File

@ -878,9 +878,7 @@ public abstract class BaseWasmGenerationVisitor implements StatementVisitor, Exp
var call = new WasmCall(function); var call = new WasmCall(function);
call.getArguments().add(new WasmGetLocal(tmp)); call.getArguments().add(new WasmGetLocal(tmp));
var arguments = expr.getArguments(); var arguments = expr.getArguments();
acceptWithType(arguments.get(0), ValueType.object(expr.getMethod().getClassName())); for (int i = 0; i < arguments.size(); i++) {
call.getArguments().add(result);
for (int i = 1; i < arguments.size(); i++) {
var argument = arguments.get(i); var argument = arguments.get(i);
acceptWithType(argument, expr.getMethod().parameterType(i)); acceptWithType(argument, expr.getMethod().parameterType(i));
call.getArguments().add(result); call.getArguments().add(result);