mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
register callbacks only if imports is needed.
This commit is contained in:
parent
593c1ee50a
commit
4525c29263
@ -113,15 +113,6 @@ class FunctionManager {
|
|||||||
*/
|
*/
|
||||||
void markAsImport( @Nonnull FunctionName name, @Nonnull Map<String, Object> importAnannotation ) {
|
void markAsImport( @Nonnull FunctionName name, @Nonnull Map<String, Object> importAnannotation ) {
|
||||||
markAsImport( name, ( key ) -> importAnannotation.get( key ) );
|
markAsImport( name, ( key ) -> importAnannotation.get( key ) );
|
||||||
|
|
||||||
// register possible callbacks as needed methods
|
|
||||||
Object callbacks = importAnannotation.get( "callbacks" );
|
|
||||||
if( callbacks != null ) {
|
|
||||||
for( Object callback : (Object[])callbacks ) {
|
|
||||||
name = new FunctionName( (String)callback );
|
|
||||||
markAsExport( name, Collections.emptyMap() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,6 +175,18 @@ class FunctionManager {
|
|||||||
state.needThisParameter = needThisParameter;
|
state.needThisParameter = needThisParameter;
|
||||||
JWebAssembly.LOGGER.fine( "\t\tcall: " + name.signatureName );
|
JWebAssembly.LOGGER.fine( "\t\tcall: " + name.signatureName );
|
||||||
usedClasses.add( name.className );
|
usedClasses.add( name.className );
|
||||||
|
|
||||||
|
if( state.importAnannotation != null ) {
|
||||||
|
// register possible callbacks of imports as needed methods
|
||||||
|
Object callbacks = state.importAnannotation.apply( "callbacks" );
|
||||||
|
if( callbacks != null ) {
|
||||||
|
for( Object callback : (Object[])callbacks ) {
|
||||||
|
name = new FunctionName( (String)callback );
|
||||||
|
markAsExport( name, Collections.emptyMap() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return state.alias == null ? name : state.alias;
|
return state.alias == null ? name : state.alias;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user