Class VariableRef

    • Constructor Detail

      • VariableRef

        public VariableRef​(CFG cfg,
                           java.lang.String name)
        Builds the untyped variable reference, identified by its name. The location where this variable reference happens is unknown (i.e. no source file/line/column is available) and its type is Untyped.INSTANCE.
        Parameters:
        cfg - the cfg that this expression belongs to
        name - the name of this variable
      • VariableRef

        public VariableRef​(CFG cfg,
                           java.lang.String name,
                           Type type)
        Builds a typed variable reference, identified by its name and its type. The location where this variable reference happens is unknown (i.e. no source file/line/column is available).
        Parameters:
        cfg - the cfg that this expression belongs to
        name - the name of this variable
        type - the type of this variable
      • VariableRef

        public VariableRef​(CFG cfg,
                           CodeLocation location,
                           java.lang.String name,
                           Type type)
        Builds the variable reference, identified by its name, happening at the given location in the program.
        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
        name - the name of this variable
        type - the type of this variable
    • Method Detail

      • setOffset

        public int setOffset​(int offset)
        Description copied from interface: Node
        Sets the offset of this node to the given value, and then proceeds by setting the one of its nested nodes (if any) to subsequent values. The last offset used is returned.
        Parameters:
        offset - the offset to set
        Returns:
        the last offset used while setting the offsets of nested nodes
      • getName

        public java.lang.String getName()
        Yields the name of this variable.
        Returns:
        the name of this variable
      • isEqualTo

        public boolean isEqualTo​(Statement st)
        Description copied from interface: Node
        Checks if this node is effectively equal to the given one, that is, if they have the same structure while potentially being different instances.
        Specified by:
        isEqualTo in interface Node<Statement,​Edge,​CFG>
        Overrides:
        isEqualTo in class Expression
        Parameters:
        st - the other node
        Returns:
        true if this node and the given one are effectively equals
      • toString

        public java.lang.String toString()
        Specified by:
        toString in class Statement
      • getVariable

        public Variable getVariable()
        Yields a Variable representing the referenced variable.
        Returns:
        the expression representing the variable
      • accept

        public <V> boolean accept​(GraphVisitor<CFG,​Statement,​Edge,​V> visitor,
                                  V tool)
        Description copied from interface: Node
        Accepts the given GraphVisitor. Implementors of this method are responsible for invoking GraphVisitor.visit(Object, Graph, Node) on this node after Node.accept(GraphVisitor, Object) has been invoked on all nested nodes, if any. The visiting should stop at the first of such calls that return false.
        Type Parameters:
        V - the type of auxiliary tool that visitor can use
        Parameters:
        visitor - the visitor that is visiting the Graph containing this node
        tool - the auxiliary tool that visitor can use
        Returns:
        whether or not the visiting should stop when this call returns, as decided by the visitor itself