improve the "ignore redefinition" in ClassPath. The first should win.

This commit is contained in:
Volker Berlin 2019-11-17 17:04:35 +01:00
parent b26b290464
commit ce1d3ddb38
2 changed files with 15 additions and 0 deletions

View File

@ -61,6 +61,17 @@ public class FunctionManager {
return state;
}
/**
* Check if this function is already known/registered.
*
* @param name
* the function name
* @return true, if known
*/
boolean isKnown( FunctionName name ) {
return states.get( name ) != null;
}
/**
* Mark the a function as a import function. Only if the function is also needed then it will imported from
* compiler.

View File

@ -367,8 +367,12 @@ public class ModuleGenerator {
private void prepareMethod( MethodInfo method ) throws WasmException {
try {
FunctionName name = new FunctionName( method );
if( functions.isKnown( name ) ) {
return;
}
Map<String,Object> annotationValues;
if( (annotationValues = method.getAnnotation( JWebAssembly.REPLACE_ANNOTATION )) != null ) {
functions.isStatic( name ); // register this class that process the annotation of this replacement function not a second time. iSKnown() returns true now.
String signatureName = (String)annotationValues.get( "value" );
name = new FunctionName( signatureName );
functions.addReplacement( name, method );