mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 18:44:47 +01:00
use class and method name as default import setting if not set
This commit is contained in:
parent
5883adc2af
commit
615efbd11f
@ -223,11 +223,13 @@ public class ModuleGenerator {
|
||||
Map<String, Object> importAnannotation = functions.getImportAnannotation( name );
|
||||
String importModule = (String)importAnannotation.get( "module" );
|
||||
if( importModule == null || importModule.isEmpty() ) {
|
||||
throw new WasmException( "Module not set for import function: " + name.signatureName, -1 );
|
||||
// use className if module is not set
|
||||
importModule = name.className.substring( name.className.lastIndexOf( '/' ) + 1 );
|
||||
}
|
||||
String importName = (String)importAnannotation.get( "name" );
|
||||
if( importName == null || importName.isEmpty() ) {
|
||||
throw new WasmException( "Name not set for import function: " + name.signatureName, -1 );
|
||||
// use method name as function if not set
|
||||
importName = name.methodName;
|
||||
}
|
||||
writer.prepareImport( name, importModule, importName );
|
||||
writeMethodSignature( name, true, null );
|
||||
|
Loading…
x
Reference in New Issue
Block a user