Class VariableExpression

  • Direct Known Subclasses:
    VariableEx

    public class VariableExpression
    extends Expression
    An expression denoting that a variable is used.
    Author:
    Holger Eichelberger
    • Field Detail

      • qualifiedName

        private java.lang.String qualifiedName
    • Constructor Detail

      • VariableExpression

        VariableExpression()
        Constructor for serialization.
      • VariableExpression

        public VariableExpression​(VariableDeclaration variable)
        Creates a variable expression node.
        Parameters:
        variable - the variable declaration used as variable here
      • VariableExpression

        public VariableExpression​(VariableDeclaration variable,
                                  java.lang.String qualifiedName)
        Creates a variable expression node.
        Parameters:
        variable - the variable declaration used as variable here
        qualifiedName - in case that not the variable itself but a qualified access to the variable is used (may be null)
    • Method Detail

      • getQualifiedName

        public java.lang.String getQualifiedName()
        The qualified name in case that not the variable itself but a qualified access to the variable was used.
        Returns:
        the qualified name, may be null
      • getName

        public java.lang.String getName()
        Returns the name of the variable beyond this node.
        Returns:
        the name of the variable
      • inferType

        public TypeDescriptor<?> inferType()
                                    throws VilException
        Description copied from class: Expression
        Infers the type of this expression including the type of the contained sub-expressions.
        Specified by:
        inferType in class Expression
        Returns:
        the type of this expression
        Throws:
        VilException - in case that inferring the type fails
      • accept

        public java.lang.Object accept​(IExpressionVisitor visitor)
                                throws VilException
        Description copied from class: Expression
        Visits the expression.
        Specified by:
        accept in class Expression
        Parameters:
        visitor - the visitor
        Returns:
        the result of visiting this expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • getDeclaration

        public VariableDeclaration getDeclaration()
        Returns the variable declaration beyond this node.
        Returns:
        the variable declaration
      • composeUnkownVariableWarning

        public static java.lang.String composeUnkownVariableWarning​(java.lang.String name)
        Composes a warning message for a missing/unknown variable.
        Parameters:
        name - the name of the variable
        Returns:
        the warning message