Class Expression

    • Constructor Detail

      • Expression

        protected Expression​(CFG cfg,
                             CodeLocation location)
        Builds an untyped expression happening at the given source location, that is its type is Untyped.INSTANCE.
        Parameters:
        cfg - the cfg that this expression belongs to
        location - the location where the expression is defined within the source file. If unknown, use null
      • Expression

        protected Expression​(CFG cfg,
                             CodeLocation location,
                             Type staticType)
        Builds a typed expression happening at the given source location.
        Parameters:
        cfg - the cfg that this expression belongs to
        location - the location where this expression is defined within the source file. If unknown, use null
        staticType - the static type of this expression
    • Method Detail

      • getStaticType

        public final Type getStaticType()
        Yields the static type of this expression.
        Returns:
        the static type of this expression
      • setRuntimeTypes

        public final void setRuntimeTypes​(ExternalSet<Type> runtimeTypes)
        Sets the runtime types of this expression.
        Parameters:
        runtimeTypes - the set of concrete types that this expression can have at runtime
      • getRuntimeTypes

        public final ExternalSet<Type> getRuntimeTypes()
        The concrete types that this expression can have at runtime. If type inference has not been executed, this method returns a singleton set containing the static type of this expression.
        Returns:
        the set of runtime types
      • getDynamicType

        public final Type getDynamicType()
        Yields the dynamic type of this expression, that is, the most specific common supertype of all its runtime types (available through getRuntimeTypes().
        Returns:
        the dynamic type of this expression
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Statement
      • setParentStatement

        public final void setParentStatement​(Statement st)
        Sets the Statement that contains this expression.
        Parameters:
        st - the containing statement
      • getParentStatement

        public final Statement getParentStatement()
        Yields the Statement that contains this expression, if any. If this method returns null, than this expression is used as a command: it is the root statement of a node in the cfg, and its returned value is discarded.
        Returns:
        the statement that contains this expression, if any
      • getRootStatement

        public final Statement getRootStatement()
        Yields the outer-most Statement containing this expression, that is used as a node in the cfg. If this expression is used a command, then this method return this.
        Returns:
        the outer-most statement containing this expression, or this