Class WithinScopeBasicSymbolsResolver
- Direct Known Subclasses:
OOWithinScopeBasicSymbolsResolver
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<SymTypeExpression> _resolveNameAsExpr(IBasicSymbolsScope enclosingScope, String name) protected Optional<SymTypeExpression> _resolveType(IBasicSymbolsScope enclosingScope, String name) protected static WithinScopeBasicSymbolsResolverprotected Predicate<FunctionSymbol> used to filter function symbols this is an extension point to, e.g., filter out constructors in OO-Symbolsprotected Predicate<TypeSymbol> used to filter type symbols this is NOT used to filter type variables this is an extension pointprotected Predicate<TypeVarSymbol> used to filter type variable symbols this is an extension pointprotected Predicate<VariableSymbol> used to filter variable symbols this is an extension pointstatic voidinit()protected booleanisNameWithQualifier(String name) static voidreset()protected List<FunctionSymbol> resolveFunctionMany(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<FunctionSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveFunctionMany(String, AccessModifier, Predicate).protected List<SymTypeOfFunction> resolveFunctionsWithoutSuperTypes(IBasicSymbolsScope enclosingScope, String name) resolves functions based on scopes without regards to types, e.g.static Optional<SymTypeExpression> resolveNameAsExpr(IBasicSymbolsScope enclosingScope, String name) resolves the name as an expression (variable or function)protected <T> Optional<T> resolverHotfix(Supplier<Optional<T>> s) workaround for Resolver throwing Exceptions...static Optional<SymTypeExpression> resolveType(IBasicSymbolsScope enclosingScope, String name) protected Optional<TypeSymbol> resolveType(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<TypeSymbol> typeSymbolPredicate) Does nothing but callIBasicSymbolsScopeTOP.resolveType(String, AccessModifier, Predicate).protected Optional<TypeVarSymbol> resolveTypeVar(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<TypeVarSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveTypeVar(String, AccessModifier, Predicate).protected Optional<VariableSymbol> resolveVariable(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<VariableSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveVariable(String, AccessModifier, Predicate).protected Optional<SymTypeExpression> resolveVariableWithoutSuperTypes(IBasicSymbolsScope enclosingScope, String name) resolves a variable based on scopes without regards to types, e.g., without adding symbols from supertypes of type scopes.protected static voidsetDelegate(WithinScopeBasicSymbolsResolver newDelegate) voidsetTypeContextCalculator(TypeContextCalculator typeCtxCalc) Deprecated, for removal: This API element is subject to removal in a future version.is now a static delegatevoidsetWithinTypeBasicSymbolsResolver(WithinTypeBasicSymbolsResolver withinTypeResolver) Deprecated, for removal: This API element is subject to removal in a future version.is now a static delegatetypeOfNameAsExpr(IBasicSymbolsScope enclosingScope, String name) Deprecated, for removal: This API element is subject to removal in a future version.typeOfNameAsTypeId(IBasicSymbolsScope enclosingScope, String name) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
delegate
-
-
Constructor Details
-
WithinScopeBasicSymbolsResolver
public WithinScopeBasicSymbolsResolver()
-
-
Method Details
-
setWithinTypeBasicSymbolsResolver
@Deprecated(forRemoval=true) public void setWithinTypeBasicSymbolsResolver(WithinTypeBasicSymbolsResolver withinTypeResolver) Deprecated, for removal: This API element is subject to removal in a future version.is now a static delegate -
setTypeContextCalculator
@Deprecated(forRemoval=true) public void setTypeContextCalculator(TypeContextCalculator typeCtxCalc) Deprecated, for removal: This API element is subject to removal in a future version.is now a static delegate -
resolveNameAsExpr
public static Optional<SymTypeExpression> resolveNameAsExpr(IBasicSymbolsScope enclosingScope, String name) resolves the name as an expression (variable or function) -
_resolveNameAsExpr
protected Optional<SymTypeExpression> _resolveNameAsExpr(IBasicSymbolsScope enclosingScope, String name) -
typeOfNameAsExpr
@Deprecated(forRemoval=true) public Optional<SymTypeExpression> typeOfNameAsExpr(IBasicSymbolsScope enclosingScope, String name) Deprecated, for removal: This API element is subject to removal in a future version. -
resolveVariableWithoutSuperTypes
protected Optional<SymTypeExpression> resolveVariableWithoutSuperTypes(IBasicSymbolsScope enclosingScope, String name) resolves a variable based on scopes without regards to types, e.g., without adding symbols from supertypes of type scopes. This is an extension point to add custom variables not in the symTab. -
resolveFunctionsWithoutSuperTypes
protected List<SymTypeOfFunction> resolveFunctionsWithoutSuperTypes(IBasicSymbolsScope enclosingScope, String name) resolves functions based on scopes without regards to types, e.g. without adding symbols from supertypes of type scopes. This is an extension point to add custom functions not in the symTab. -
getFunctionPredicate
used to filter function symbols this is an extension point to, e.g., filter out constructors in OO-Symbols -
resolveFunctionMany
protected List<FunctionSymbol> resolveFunctionMany(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<FunctionSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveFunctionMany(String, AccessModifier, Predicate). This is an extension point. S. a.resolveType(IBasicSymbolsScope, String, AccessModifier, Predicate) -
getVariablePredicate
used to filter variable symbols this is an extension point -
resolveVariable
protected Optional<VariableSymbol> resolveVariable(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<VariableSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveVariable(String, AccessModifier, Predicate). This is an extension point. S. a.resolveType(IBasicSymbolsScope, String, AccessModifier, Predicate) -
resolveType
public static Optional<SymTypeExpression> resolveType(IBasicSymbolsScope enclosingScope, String name) -
_resolveType
-
typeOfNameAsTypeId
@Deprecated(forRemoval=true) public Optional<SymTypeExpression> typeOfNameAsTypeId(IBasicSymbolsScope enclosingScope, String name) Deprecated, for removal: This API element is subject to removal in a future version. -
getTypePredicate
used to filter type symbols this is NOT used to filter type variables this is an extension point -
resolveType
protected Optional<TypeSymbol> resolveType(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<TypeSymbol> typeSymbolPredicate) Does nothing but callIBasicSymbolsScopeTOP.resolveType(String, AccessModifier, Predicate). This is an extension point.A use case is to, instead of logging an error on finding multiple symbols with the same name, select one deterministically and continue with it. Advantages: * One can find more errors in the same run of the tool. * One does not get multiple instances of the error that multiple symbols exist with the same name Disadvantages: * One has to rely on the generation of the symboltable to already have logged the error of multiple instances of symbols with the same name. * Error messages are harder to understand, as the modeler might not notice this selection, does not know about the second Symbol definition, and tries to fix an issue that lies elsewhere. (Especially, if they don't start at the first reported model error)
Due to the low quality of our tooling in several of our languages, this is not enabled by default, but must be implemented in the specific languages.
-
getTypeVarPredicate
used to filter type variable symbols this is an extension point -
resolveTypeVar
protected Optional<TypeVarSymbol> resolveTypeVar(IBasicSymbolsScope enclosingScope, String name, de.monticore.symboltable.modifiers.AccessModifier accessModifier, Predicate<TypeVarSymbol> predicate) Does nothing but callIBasicSymbolsScopeTOP.resolveTypeVar(String, AccessModifier, Predicate). This is an extension point. S. a.resolveType(IBasicSymbolsScope, String, AccessModifier, Predicate) -
isNameWithQualifier
- Returns:
- true for "a.b", false for "a"
-
resolverHotfix
workaround for Resolver throwing Exceptions...note: Exception is not supposed to happen, thus, never rely on this(!) Error being logged (here) some error should be logged, though. This method is to be removed in the future
Error considered internal, as the Exception should not have been thrown.
-
init
public static void init() -
reset
public static void reset() -
setDelegate
-
getDelegate
-