public abstract class AbstractJavaParserContext<N extends Node> extends Object implements Context
Modifier and Type | Field and Description |
---|---|
protected TypeSolver |
typeSolver |
protected N |
wrappedNode |
Constructor and Description |
---|
AbstractJavaParserContext(N wrappedNode,
TypeSolver typeSolver) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
fieldDeclarationInScope, fieldsExposedToChild, localVariableDeclarationInScope, localVariablesExposedToChild, parameterDeclarationInScope, parametersExposedToChild, solveConstructor, solveGenericType, solveGenericTypeInParentContext, solveMethod, solveMethodInParentContext, solveSymbol, solveSymbolAsValue, solveSymbolAsValueInParentContext, solveType, solveType, solveTypeInParentContext, solveTypeInParentContext, typePatternExprInScope, typePatternExprsExposedToChild
protected TypeSolver typeSolver
public AbstractJavaParserContext(N wrappedNode, TypeSolver typeSolver)
public static SymbolReference<ResolvedValueDeclaration> solveWith(SymbolDeclarator symbolDeclarator, String name)
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbolInParentContext(String name)
solveSymbolInParentContext
in interface Context
protected Optional<Value> solveWithAsValue(SymbolDeclarator symbolDeclarator, String name)
protected Collection<ResolvedReferenceTypeDeclaration> findTypeDeclarations(Optional<Expression> optScope)
public Optional<MethodUsage> solveMethodAsUsage(String name, List<ResolvedType> argumentsTypes)
solveMethodAsUsage
in interface Context
public N getWrappedNode()
getWrappedNode
in interface Context
public List<TypePatternExpr> typePatternExprsDiscoveredInPattern(PatternExpr patternExpr)
Foo f
), in which case we can just compare
the name of the variable we're trying to resolve with the name declared in the pattern.
2. The pattern expression is a record pattern expression (e.g. Foo (Bar b, Baz (...) )
), in which case
we need to traverse the "pattern tree" to find all type pattern expressions, so that we can compare names
for all of these.
In both cases, we only really care about the type pattern expressions, so this method simply does a traversal
of the pattern tree to find all type pattern expressions contained in it.patternExpr
- the root of the pattern tree to traversepublic SymbolReference<? extends ResolvedValueDeclaration> findExposedPatternInParentContext(Node parent, String name)
public List<TypePatternExpr> typePatternExprsExposedFromChildren()
typePatternExprsExposedFromChildren
in interface Context
public List<TypePatternExpr> negatedTypePatternExprsExposedFromChildren()
negatedTypePatternExprsExposedFromChildren
in interface Context
Copyright © 2007–2024. All rights reserved.