Fix "import" in the text format

This commit is contained in:
Volker 2018-08-14 18:17:48 +02:00
parent 80a8b5d00d
commit 5f0c24f5af

View File

@ -44,6 +44,8 @@ public class TextModuleWriter extends ModuleWriter {
private int inset; private int inset;
private boolean isImport;
private HashSet<String> globals = new HashSet<>(); private HashSet<String> globals = new HashSet<>();
/** /**
@ -77,7 +79,8 @@ public class TextModuleWriter extends ModuleWriter {
protected void prepareImport( FunctionName name, String importModule, String importName ) throws IOException { protected void prepareImport( FunctionName name, String importModule, String importName ) throws IOException {
if( importName != null ) { if( importName != null ) {
newline( output ); newline( output );
output.append( "(import \"" ).append( importModule ).append( "\" \"" ).append( importName ).append( "\" (func $" ).append( name.fullName ).append( "))" ); output.append( "(import \"" ).append( importModule ).append( "\" \"" ).append( importName ).append( "\" (func $" ).append( name.fullName );
isImport = true;
} }
} }
@ -114,7 +117,12 @@ public class TextModuleWriter extends ModuleWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
protected void writeMethodParamFinish() throws IOException {} protected void writeMethodParamFinish() throws IOException {
if( isImport ) {
isImport = false;
output.append( "))" );
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}