Class AssignableExpression
- java.lang.Object
-
- org.jboss.byteman.rule.RuleElement
-
- org.jboss.byteman.rule.expression.Expression
-
- org.jboss.byteman.rule.expression.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 Summary
Constructors Modifier Constructor Description protected
AssignableExpression(Rule rule, Type type, ParseNode token)
Create a new expression.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
bindAssign()
bind as an assignable expression.abstract void
compileAssign(org.objectweb.asm.MethodVisitor mv, CompileContext compileContext)
compile an assignment to the referenced location using the value on the top of the Java stack.abstract java.lang.Object
interpretAssign(HelperAdapter helperAdapter, java.lang.Object value)
execute an assignment to the referenced location by interpretation of the expression, using the object passed in this callabstract Type
typeCheckAssign(Type expected)
typecheck the expression as an lvalue of an assignment operation-
Methods inherited from class org.jboss.byteman.rule.expression.Expression
bind, getPos, getType, interpret, typeCheck, writeTo
-
Methods inherited from class org.jboss.byteman.rule.RuleElement
compile, getBindings, getTypeGroup, rebox, toString
-
-
-
-
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 visitorcompileContext
- 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
-
-