Class DeclaredReferenceExpression
java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.statements.Statement
de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression
de.fraunhofer.aisec.cpg.graph.statements.expressions.DeclaredReferenceExpression
- All Implemented Interfaces:
DeclarationHolder,HasType,HasType.TypeListener,Persistable,IVisitable<de.fraunhofer.aisec.cpg.graph.Node>
- Direct Known Subclasses:
MemberExpression
public class DeclaredReferenceExpression extends Expression implements HasType.TypeListener
An expression, which refers to something which is declared, e.g. a variable. For example, the
expression
a = b, which itself is a BinaryOperator, contains two DeclaredReferenceExpressions, one for the variable a and one for variable b
, which have been previously been declared.-
Nested Class Summary
Nested classes/interfaces inherited from class de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.Node.CompanionNested classes/interfaces inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
HasType.SecondaryTypeEdge, HasType.TypeListener -
Field Summary
Fields inherited from class de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression
typeFields inherited from class de.fraunhofer.aisec.cpg.graph.Node
Companion, EMPTY_NAME, TO_STRING_STYLE -
Constructor Summary
Constructors Constructor Description DeclaredReferenceExpression() -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)AccessValuesgetAccess()@Nullable DeclarationgetRefersTo()<T extends VariableDeclaration>
@Nullable TgetRefersToAs(java.lang.Class<T> clazz)Returns the contents ofrefersToas the specified class, if the class is assignable.inthashCode()booleanisStaticAccess()voidpossibleSubTypesChanged(HasType src, java.util.Collection<HasType> root, java.util.Set<Type> oldSubTypes)voidsetAccess(AccessValues access)voidsetRefersTo(@Nullable Declaration refersTo)voidsetStaticAccess(boolean staticAccess)java.lang.StringtoString()voidtypeChanged(HasType src, java.util.Collection<HasType> root, Type oldType)Methods inherited from class de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression
getPossibleSubTypes, getPropagationType, getType, getTypeListeners, refreshType, registerTypeListener, resetTypes, setPossibleSubTypes, setType, unregisterTypeListener, updatePossibleSubtypes, updateTypeMethods inherited from class de.fraunhofer.aisec.cpg.graph.statements.Statement
addDeclaration, getDeclarations, getLocals, getLocalsPropertyEdge, removeLocal, setLocalsMethods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addAnnotations, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, getAnnotations, getArgumentIndex, getAstChildren, getCode, getComment, getFile, getId, getLocation, getName, getNextDFG, getNextEOG, getNextEOGEdges, getPrevDFG, getPrevEOG, getPrevEOGEdges, getTypedefs, isImplicit, isInferred, removeNextDFG, removePrevDFG, removePrevEOGEntry, setAnnotations, setArgumentIndex, setCode, setComment, setFile, setId, setImplicit, setInferred, setLocation, setName, setNextDFG, setNextEOG, setNextEOGEdges, setPrevDFG, setPrevEOG, setPrevEOGEdges, setTypedefsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.fraunhofer.aisec.cpg.graph.DeclarationHolder
addIfNotContains, addIfNotContains, addIfNotContainsMethods inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
setPossibleSubTypes, setTypeMethods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable
accept
-
Constructor Details
-
DeclaredReferenceExpression
public DeclaredReferenceExpression()
-
-
Method Details
-
isStaticAccess
public boolean isStaticAccess() -
setStaticAccess
public void setStaticAccess(boolean staticAccess) -
getRefersTo
-
getRefersToAs
Returns the contents ofrefersToas the specified class, if the class is assignable. Otherwise, it will return null.- Type Parameters:
T- the type- Parameters:
clazz- the expected class- Returns:
- the declaration cast to the expected class, or null if the class is not assignable
-
getAccess
-
setRefersTo
-
typeChanged
- Specified by:
typeChangedin interfaceHasType.TypeListener
-
possibleSubTypesChanged
public void possibleSubTypesChanged(HasType src, java.util.Collection<HasType> root, java.util.Set<Type> oldSubTypes)- Specified by:
possibleSubTypesChangedin interfaceHasType.TypeListener
-
toString
public java.lang.String toString()- Overrides:
toStringin classExpression
-
setAccess
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classExpression
-
hashCode
public int hashCode()- Overrides:
hashCodein classExpression
-