public class ArrayAccessExprContext extends AbstractJavaParserContext<ArrayAccessExpr>
Required to prevent recursive access to the "parent node" (not necessarily the same as the "parent context").
Consider, for example, this code where the cursor is currently at the node of type ArrayAccessExpr
:
var1.perPriority[index].recovered
^^^^^^^^^^^^^^^^^^^^^^^ - ArrayAccessExpr
The AST for this snippet:
FieldAccessExpr // This FieldAccessExpr is accessing the field `recovered`
/ \
**ArrayAccessExpr** SimpleName(recovered)
/ \
FieldAccessExpr NameExpr(index) // This FieldAccessExpr is accessing the field `perPriority`
/ \
NameExpr(var1) SimpleName (perPriority)
In this example:
ArrayAccessExpr
is FieldAccessExpr
(variable1.perPriority[index].recovered
).
// "Parent Node" of the ArrayAccessExpr
var.perPriority[index].recovered
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - FieldAccessExpr
^^^^^^^^^^^^^^^^^^^^^^ - ArrayAccessExpr
^^^^^^^^^ - SimpleName
FieldAccessExpr
to the left of the outer array-access, which is actually a child node.
// "Parent Context" of the ArrayAccessExpr
var1.perPriority[index].recovered
^^^^^^^^^^^^^^^^^^^^^^^ - ArrayAccessExpr
^^^^^^^^^^^^^^^^ - FieldAccessExpr
^^^^^ - NameExpr
typeSolver, wrappedNode
Constructor and Description |
---|
ArrayAccessExprContext(ArrayAccessExpr wrappedNode,
TypeSolver typeSolver) |
Modifier and Type | Method and Description |
---|---|
SymbolReference<? extends ResolvedValueDeclaration> |
solveSymbolInParentContext(String name) |
equals, findTypeDeclarations, getParent, getScope, getWrappedNode, hashCode, isQualifiedName, solveWith, solveWithAsValue
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
fieldDeclarationInScope, fieldsExposedToChild, localVariableDeclarationInScope, localVariablesExposedToChild, negatedPatternExprsExposedFromChildren, parameterDeclarationInScope, parametersExposedToChild, patternExprInScope, patternExprsExposedFromChildren, patternExprsExposedToChild, solveConstructor, solveGenericType, solveGenericTypeInParentContext, solveMethod, solveMethodAsUsage, solveMethodInParentContext, solveSymbol, solveSymbolAsValue, solveSymbolAsValueInParentContext, solveType, solveTypeInParentContext
public ArrayAccessExprContext(ArrayAccessExpr wrappedNode, TypeSolver typeSolver)
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbolInParentContext(String name)
solveSymbolInParentContext
in interface Context
solveSymbolInParentContext
in class AbstractJavaParserContext<ArrayAccessExpr>
Copyright © 2007–2022. All rights reserved.