mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 10:44:47 +01:00
pass through FunctionName object
This commit is contained in:
parent
2c792f4a4f
commit
d8de454a3f
@ -699,17 +699,18 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void writeFunctionCall( String name ) throws IOException {
|
||||
protected void writeFunctionCall( FunctionName name ) throws IOException {
|
||||
String signatureName = name.signatureName;
|
||||
int id;
|
||||
Function func = functions.get( name );
|
||||
Function func = functions.get( signatureName );
|
||||
if( func != null ) {
|
||||
id = func.id;
|
||||
} else {
|
||||
ImportFunction entry = imports.get( name );
|
||||
ImportFunction entry = imports.get( signatureName );
|
||||
if( entry != null ) {
|
||||
id = entry.id;
|
||||
} else {
|
||||
throw new WasmException( "Call to unknown function: " + name, null, null, -1 );
|
||||
throw new WasmException( "Call to unknown function: " + signatureName, null, null, -1 );
|
||||
}
|
||||
}
|
||||
codeStream.writeOpCode( CALL );
|
||||
|
@ -186,11 +186,11 @@ public abstract class ModuleWriter implements Closeable {
|
||||
* Write a call to a function.
|
||||
*
|
||||
* @param name
|
||||
* the full qualified method name
|
||||
* the function name
|
||||
* @throws IOException
|
||||
* if any I/O error occur
|
||||
*/
|
||||
protected abstract void writeFunctionCall( String name ) throws IOException;
|
||||
protected abstract void writeFunctionCall( FunctionName name ) throws IOException;
|
||||
|
||||
/**
|
||||
* Write a block/branch code
|
||||
|
@ -53,7 +53,7 @@ class WasmCallInstruction extends WasmInstruction {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void writeTo( @Nonnull ModuleWriter writer ) throws IOException {
|
||||
writer.writeFunctionCall( new FunctionName( method ).signatureName );
|
||||
writer.writeFunctionCall( new FunctionName( method ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,10 +285,11 @@ public class TextModuleWriter extends ModuleWriter {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void writeFunctionCall( String name ) throws IOException {
|
||||
protected void writeFunctionCall( FunctionName name ) throws IOException {
|
||||
newline( methodOutput );
|
||||
name = name.substring( 0, name.indexOf( '(' ) );
|
||||
methodOutput.append( "call $" ).append( name );
|
||||
String signatureName = name.signatureName;
|
||||
signatureName = signatureName.substring( 0, signatureName.indexOf( '(' ) );
|
||||
methodOutput.append( "call $" ).append( signatureName );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user