mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Move method name creation into WasmCallInstruction
This commit is contained in:
parent
d16b2b63c2
commit
d3e80bf709
@ -242,7 +242,7 @@ public class ModuleGenerator {
|
|||||||
* the index in the signature
|
* the index in the signature
|
||||||
* @return the value type or null if void
|
* @return the value type or null if void
|
||||||
*/
|
*/
|
||||||
private ValueType getValueType( String signature, int idx ) {
|
static ValueType getValueType( String signature, int idx ) {
|
||||||
String javaType;
|
String javaType;
|
||||||
switch( signature.charAt( idx ) ) {
|
switch( signature.charAt( idx ) ) {
|
||||||
case '[': // array
|
case '[': // array
|
||||||
@ -267,7 +267,7 @@ public class ModuleGenerator {
|
|||||||
default:
|
default:
|
||||||
javaType = signature.substring( idx, idx + 1 );
|
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 ) {
|
if( type != null ) {
|
||||||
stackManager.add( type, codePos );
|
stackManager.add( type, codePos );
|
||||||
}
|
}
|
||||||
instr = new WasmCallInstruction( method.getConstantClass().getName() + '.' + method.getName() + method.getType(), codePos );
|
instr = new WasmCallInstruction( method, codePos );
|
||||||
break;
|
break;
|
||||||
//TODO case 185: // invokeinterface
|
//TODO case 185: // invokeinterface
|
||||||
//TODO case 187: // new
|
//TODO case 187: // new
|
||||||
|
@ -20,6 +20,8 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import de.inetsoftware.classparser.ConstantRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WasmInstruction for a function call.
|
* WasmInstruction for a function call.
|
||||||
*
|
*
|
||||||
@ -33,14 +35,14 @@ class WasmCallInstruction extends WasmInstruction {
|
|||||||
/**
|
/**
|
||||||
* Create an instance of a function call instruction
|
* Create an instance of a function call instruction
|
||||||
*
|
*
|
||||||
* @param name
|
* @param method
|
||||||
* the Java function name
|
* the reference to the Java method
|
||||||
* @param javaCodePos
|
* @param javaCodePos
|
||||||
* the code position/offset in the Java method
|
* the code position/offset in the Java method
|
||||||
*/
|
*/
|
||||||
WasmCallInstruction( String name, int javaCodePos ) {
|
WasmCallInstruction( ConstantRef method, int javaCodePos ) {
|
||||||
super( javaCodePos );
|
super( javaCodePos );
|
||||||
this.name = name;
|
this.name = new FunctionName( method ).signatureName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user