fix function count in table declaration

This commit is contained in:
Volker Berlin 2019-06-04 18:56:53 +02:00
parent c410adc636
commit 6da4a93918

View File

@ -77,8 +77,6 @@ public class TextModuleWriter extends ModuleWriter {
private boolean useExceptions; private boolean useExceptions;
private int functionCount;
private boolean callIndirect; private boolean callIndirect;
/** /**
@ -114,7 +112,7 @@ public class TextModuleWriter extends ModuleWriter {
output.append( methodOutput ); output.append( methodOutput );
if( callIndirect ) { if( callIndirect ) {
int count = functionCount; int count = functions.size();
String countStr = Integer.toString( count ); String countStr = Integer.toString( count );
newline( output ); newline( output );
output.append( "(table " ).append( countStr ).append( ' ' ).append( countStr ).append( " anyfunc)" ); output.append( "(table " ).append( countStr ).append( ' ' ).append( countStr ).append( " anyfunc)" );
@ -270,7 +268,6 @@ public class TextModuleWriter extends ModuleWriter {
protected void writeMethodParamStart( @Nonnull FunctionName name ) throws IOException { protected void writeMethodParamStart( @Nonnull FunctionName name ) throws IOException {
typeOutput.setLength( 0 ); typeOutput.setLength( 0 );
methodParamNames.clear(); methodParamNames.clear();
functionCount++;
} }
/** /**