Error message for native methods

This commit is contained in:
Volker Berlin 2019-03-12 22:36:43 +01:00
parent c2be64a525
commit 4bb145d116
2 changed files with 11 additions and 1 deletions

View File

@ -352,7 +352,7 @@ public class ModuleGenerator {
codeBuilder = javaCodeBuilder; codeBuilder = javaCodeBuilder;
localVariableTable = code.getLocalVariableTable(); localVariableTable = code.getLocalVariableTable();
} else { } else {
return; throw new WasmException( "Abstract or native method can not be used: " + name.fullName, -1 );
} }
writeExport( name, method ); writeExport( name, method );
writeMethodImpl( name, method.isStatic(), localVariableTable, codeBuilder ); writeMethodImpl( name, method.isStatic(), localVariableTable, codeBuilder );

View File

@ -110,4 +110,14 @@ public class RuntimeErrors {
return 1; return 1;
} }
} }
@Test
public void nativeMethod() throws IOException {
compileErrorTest( "Abstract or native method can not be used:", NativeMethod.class );
}
static class NativeMethod {
@Export
native static float function();
}
} }