public SmiSymbol resolveReference ( IdToken idToken , XRefProblemReporter reporter ) { // doesn't work anymore with hardcoded missing symbols // if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) { // // note this check is not entirely fool-proof in case multiple modules are located in one file // throw new IllegalArgumentException("Resolving references is only allowed from inside the same module"); // } SmiSymbol result = findSymbol ( idToken . getId ( ) ) ; if ( result == null ) { result = findImportedSymbol ( idToken . getId ( ) ) ; } if ( result == null ) { List < SmiSymbol > symbols = getMib ( ) . getSymbols ( ) . findAll ( idToken . getId ( ) ) ; if ( symbols . size ( ) == 1 ) { result = symbols . get ( 0 ) ; } else if ( symbols . size ( ) > 0 ) { result = determineBestMatch ( idToken , symbols ) ; } } if ( result == null && reporter != null ) { reporter . reportCannotFindSymbol ( idToken ) ; } return result ; }
Resolves a reference from within this module to a symbol in the same module an imported module or in the whole mib