From d3e80bf7098ec1a8f1de063ed0b4210e9c5aeec4 Mon Sep 17 00:00:00 2001 From: Volker Date: Mon, 6 Aug 2018 12:46:18 +0200 Subject: [PATCH] Move method name creation into WasmCallInstruction --- .../jwebassembly/module/ModuleGenerator.java | 6 +++--- .../jwebassembly/module/WasmCallInstruction.java | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java index c4a5c08..4b8aa8c 100644 --- a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java +++ b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java @@ -242,7 +242,7 @@ public class ModuleGenerator { * the index in the signature * @return the value type or null if void */ - private ValueType getValueType( String signature, int idx ) { + static ValueType getValueType( String signature, int idx ) { String javaType; switch( signature.charAt( idx ) ) { case '[': // array @@ -267,7 +267,7 @@ public class ModuleGenerator { default: javaType = signature.substring( idx, idx + 1 ); } - throw new WasmException( "Not supported Java data type in method signature: " + javaType, sourceFile, -1 ); + throw new WasmException( "Not supported Java data type in method signature: " + javaType, null, -1 ); } /** @@ -692,7 +692,7 @@ public class ModuleGenerator { if( type != null ) { stackManager.add( type, codePos ); } - instr = new WasmCallInstruction( method.getConstantClass().getName() + '.' + method.getName() + method.getType(), codePos ); + instr = new WasmCallInstruction( method, codePos ); break; //TODO case 185: // invokeinterface //TODO case 187: // new diff --git a/src/de/inetsoftware/jwebassembly/module/WasmCallInstruction.java b/src/de/inetsoftware/jwebassembly/module/WasmCallInstruction.java index 57c58ae..d5aa552 100644 --- a/src/de/inetsoftware/jwebassembly/module/WasmCallInstruction.java +++ b/src/de/inetsoftware/jwebassembly/module/WasmCallInstruction.java @@ -20,6 +20,8 @@ import java.io.IOException; import javax.annotation.Nonnull; +import de.inetsoftware.classparser.ConstantRef; + /** * WasmInstruction for a function call. * @@ -33,14 +35,14 @@ class WasmCallInstruction extends WasmInstruction { /** * Create an instance of a function call instruction * - * @param name - * the Java function name + * @param method + * the reference to the Java method * @param javaCodePos * the code position/offset in the Java method */ - WasmCallInstruction( String name, int javaCodePos ) { + WasmCallInstruction( ConstantRef method, int javaCodePos ) { super( javaCodePos ); - this.name = name; + this.name = new FunctionName( method ).signatureName; } /**