From 1a89919984ce99ac588160524f0b1898c30d261f Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Tue, 26 Nov 2019 21:44:49 +0100 Subject: [PATCH] the dup of this must on the end if there are no more parameters --- src/de/inetsoftware/jwebassembly/module/WasmCodeBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/inetsoftware/jwebassembly/module/WasmCodeBuilder.java b/src/de/inetsoftware/jwebassembly/module/WasmCodeBuilder.java index 3e4a65e..896f3a0 100644 --- a/src/de/inetsoftware/jwebassembly/module/WasmCodeBuilder.java +++ b/src/de/inetsoftware/jwebassembly/module/WasmCodeBuilder.java @@ -481,7 +481,7 @@ public abstract class WasmCodeBuilder { } if( varIndex < 0 ) { varIndex = getTempVariable( virtualCall.getThisType(), instr.getCodePosition(), javaCodePos + 1 ); - idx = findPushInstruction( count - 1, false ); + idx = count == 1 ? instructions.size() : findPushInstruction( count - 1, false ); instructions.add( idx, new DupThis( virtualCall, varIndex, javaCodePos ) ); } virtualCall.setVariableIndexOfThis( varIndex );