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
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.
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AssignableExpression
(Rule rule, Type type, ParseNode token) Create a new expression. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
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 Object
interpretAssign
(HelperAdapter helperAdapter, 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 operationMethods 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
-
Constructor Details
-
AssignableExpression
Create a new expression.- Parameters:
rule
- the rule this expression belongs totype
- the current type for this expression.token
- the token for this expression.
-
-
Method Details
-
typeCheckAssign
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 Object interpretAssign(HelperAdapter helperAdapter, 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
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
-