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.
  • Constructor Details

    • DeclaredReferenceExpression

      public DeclaredReferenceExpression()
  • Method Details

    • isStaticAccess

      public boolean isStaticAccess()
    • setStaticAccess

      public void setStaticAccess​(boolean staticAccess)
    • getRefersTo

      public @Nullable Declaration getRefersTo()
    • getRefersToAs

      public <T extends VariableDeclaration> @Nullable T getRefersToAs​(java.lang.Class<T> clazz)
      Returns the contents of refersTo as 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

      public AccessValues getAccess()
    • setRefersTo

      public void setRefersTo​(@Nullable Declaration refersTo)
    • typeChanged

      public void typeChanged​(HasType src, java.util.Collection<HasType> root, Type oldType)
      Specified by:
      typeChanged in interface HasType.TypeListener
    • possibleSubTypesChanged

      public void possibleSubTypesChanged​(HasType src, java.util.Collection<HasType> root, java.util.Set<Type> oldSubTypes)
      Specified by:
      possibleSubTypesChanged in interface HasType.TypeListener
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class Expression
    • setAccess

      public void setAccess​(AccessValues access)
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class Expression
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Expression