Class AssignableExpression

  • Direct Known Subclasses:
    ArrayExpression, DollarExpression, FieldExpression, StaticExpression, Variable

    public abstract class AssignableExpression
    extends Expression
    an expression which can appear on the left hand side of an assignment expression as well as in any other expression context. assignable expressions provide extra methods which support assignment, either interpreted or compiled, on top of the usual evaluation methods.
    • Constructor Detail

      • AssignableExpression

        protected AssignableExpression​(Rule rule,
                                       Type type,
                                       ParseNode token)
        Create a new expression.
        Parameters:
        rule - the rule this expression belongs to
        type - the current type for this expression.
        token - the token for this expression.
    • Method Detail

      • typeCheckAssign

        public abstract Type typeCheckAssign​(Type expected)
                                      throws TypeException
        typecheck the expression as an lvalue of an assignment operation
        Parameters:
        expected - the expected type for the expression
        Returns:
        the expression type
        Throws:
        TypeException - if a type check error occurs
      • interpretAssign

        public abstract java.lang.Object interpretAssign​(HelperAdapter helperAdapter,
                                                         java.lang.Object value)
                                                  throws ExecuteException
        execute an assignment to the referenced location by interpretation of the expression, using the object passed in this call
        Parameters:
        helperAdapter - an execution context associated with the rule which contains a map of current bindings for rule variables and another map of their declared types both of which are indexed by variable name. This includes entries for the helper (name "-1"), the recipient if the trigger method is not static (name "0") and the trigger method arguments (names "1", ...)
        value - the value to be assigned to this object
        Returns:
        the result of evaluation as an Object
        Throws:
        ExecuteException - if an error occurs during execution
      • compileAssign

        public abstract void compileAssign​(org.objectweb.asm.MethodVisitor mv,
                                           CompileContext compileContext)
                                    throws CompileException
        compile an assignment to the referenced location using the value on the top of the Java stack.
        Parameters:
        mv - the current method visitor
        compileContext - the current compile context
        Throws:
        CompileException - if a compile error occurs
      • bindAssign

        public abstract void bindAssign()
                                 throws TypeException
        bind as an assignable expression. for variables and dollar expressions this will ensure that a binding exists and that it is marked as potentially updateable.
        Throws:
        TypeException - if the expression contains an invalid or unassignable reference