Interface HasType

All Known Implementing Classes:
ArrayCreationExpression, ArrayRangeExpression, ArraySubscriptionExpression, BinaryOperator, CallExpression, CastExpression, CompoundStatementExpression, ConditionalExpression, ConstructorDeclaration, DeclaredReferenceExpression, DeleteExpression, DesignatedInitializerExpression, EnumConstantDeclaration, ExplicitConstructorInvocation, Expression, ExpressionList, FieldDeclaration, FunctionDeclaration, InitializerListExpression, Literal, MemberCallExpression, MemberExpression, MethodDeclaration, NewExpression, ParamVariableDeclaration, ProblemDeclaration, StaticCallExpression, TypeExpression, TypeIdExpression, TypeParamDeclaration, UnaryOperator, UninitializedValue, ValueDeclaration, VariableDeclaration

public interface HasType
  • Method Details

    • getType

      Type getType()
    • getPropagationType

      Type getPropagationType()
      Returns:
      The returned Type is always the same as getType() with the exception of ReferenceType since there is no case in which we want to propagate a reference when using typeChanged()
    • setType

      default void setType​(Type type)
    • updateType

      void updateType​(Type type)
      Sideeffect free type modification WARNING: This should only be used by the TypeSystem Pass
      Parameters:
      type - new type
    • updatePossibleSubtypes

      void updatePossibleSubtypes​(java.util.Set<Type> types)
    • setType

      void setType​(Type type, HasType root)
      Set the node's type. This may start a chain of type listener notifications
      Parameters:
      type - new type
      root - The node that initiated the type change chain. When a node receives a type setting command where root == this, we know that we have a type listener circle and can abort. If root == null, the type change is seen as an externally triggered event and subsequent type listeners receive the current node as their root.
    • getPossibleSubTypes

      java.util.Set<Type> getPossibleSubTypes()
    • setPossibleSubTypes

      default void setPossibleSubTypes​(java.util.Set<Type> possibleSubTypes)
    • setPossibleSubTypes

      void setPossibleSubTypes​(java.util.Set<Type> possibleSubTypes, HasType root)
      Set the node's possible subtypes. Listener circle detection works the same way as with setType(Type, HasType)
      Parameters:
      possibleSubTypes -
      root -
    • registerTypeListener

      void registerTypeListener​(HasType.TypeListener listener)
    • unregisterTypeListener

      void unregisterTypeListener​(HasType.TypeListener listener)
    • getTypeListeners

      java.util.Set<HasType.TypeListener> getTypeListeners()
    • refreshType

      void refreshType()
    • resetTypes

      void resetTypes​(Type type)
      Used to set the type and clear the possible subtypes list for when a type is more precise than the current.
      Parameters:
      type - the more precise type