Class ValueAssignmentExpression


  • public class ValueAssignmentExpression
    extends Expression
    Represents a value assignment.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ValueAssignmentExpression

        ValueAssignmentExpression()
        Constructor for serialization.
      • ValueAssignmentExpression

        public ValueAssignmentExpression​(VariableDeclaration varDecl,
                                         Expression valueExpression)
        Creates a new value assignment expression which assigns valueExpression to varDecl.
        Parameters:
        varDecl - the variable declaration
        valueExpression - the value expression
      • ValueAssignmentExpression

        public ValueAssignmentExpression​(VariableDeclaration varDecl,
                                         FieldDescriptor field,
                                         Expression valueExpression)
        Creates a new value assignment expression which assigns valueExpression to field in varDecl.
        Parameters:
        varDecl - the variable declaration
        field - the field declaration (optional, may be null)
        valueExpression - the value expression
    • Method Detail

      • getVarDecl

        public VariableDeclaration getVarDecl()
        Returns the variable declaration.
        Returns:
        the variable declaration
      • getField

        public FieldDescriptor getField()
        The field to assign to.
        Returns:
        the field (may be null)
      • getValueExpression

        public Expression getValueExpression()
        Returns the value expression.
        Returns:
        the value expression
      • 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)