mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 23:47:51 +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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void writeFunctionCall( String name ) throws IOException {
|
protected void writeFunctionCall( FunctionName name ) throws IOException {
|
||||||
|
String signatureName = name.signatureName;
|
||||||
int id;
|
int id;
|
||||||
Function func = functions.get( name );
|
Function func = functions.get( signatureName );
|
||||||
if( func != null ) {
|
if( func != null ) {
|
||||||
id = func.id;
|
id = func.id;
|
||||||
} else {
|
} else {
|
||||||
ImportFunction entry = imports.get( name );
|
ImportFunction entry = imports.get( signatureName );
|
||||||
if( entry != null ) {
|
if( entry != null ) {
|
||||||
id = entry.id;
|
id = entry.id;
|
||||||
} else {
|
} 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 );
|
codeStream.writeOpCode( CALL );
|
||||||
|
@ -186,11 +186,11 @@ public abstract class ModuleWriter implements Closeable {
|
|||||||
* Write a call to a function.
|
* Write a call to a function.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the full qualified method name
|
* the function name
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* if any I/O error occur
|
* 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
|
* Write a block/branch code
|
||||||
|
@ -53,7 +53,7 @@ class WasmCallInstruction extends WasmInstruction {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void writeTo( @Nonnull ModuleWriter writer ) throws IOException {
|
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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void writeFunctionCall( String name ) throws IOException {
|
protected void writeFunctionCall( FunctionName name ) throws IOException {
|
||||||
newline( methodOutput );
|
newline( methodOutput );
|
||||||
name = name.substring( 0, name.indexOf( '(' ) );
|
String signatureName = name.signatureName;
|
||||||
methodOutput.append( "call $" ).append( name );
|
signatureName = signatureName.substring( 0, signatureName.indexOf( '(' ) );
|
||||||
|
methodOutput.append( "call $" ).append( signatureName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user