Add getFunctionName() for available check.

This commit is contained in:
Volker Berlin 2018-11-24 21:09:56 +01:00
parent eaeb09ee48
commit 1655310a0f

View File

@ -34,6 +34,8 @@ class WasmCallInstruction extends WasmInstruction {
private final ValueType valueType; private final ValueType valueType;
private final FunctionName name;
/** /**
* Create an instance of a function call instruction * Create an instance of a function call instruction
* *
@ -45,15 +47,25 @@ class WasmCallInstruction extends WasmInstruction {
WasmCallInstruction( Member method, int javaCodePos ) { WasmCallInstruction( Member method, int javaCodePos ) {
super( javaCodePos ); super( javaCodePos );
this.method = method; this.method = method;
this.name = new FunctionName( method );
String signature = method.getType(); String signature = method.getType();
this.valueType = ValueType.getValueType( signature, signature.indexOf( ')' ) + 1 ); this.valueType = ValueType.getValueType( signature, signature.indexOf( ')' ) + 1 );
} }
/**
* Get the function name that should be called
* @return the name
*/
@Nonnull
FunctionName getFunctionName() {
return name;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeTo( @Nonnull ModuleWriter writer ) throws IOException { public void writeTo( @Nonnull ModuleWriter writer ) throws IOException {
writer.writeFunctionCall( new FunctionName( method ) ); writer.writeFunctionCall( name );
} }
/** /**