The quasi-parallel assignment statements are used to indirectly assign values to property variables (Section 7.1, “Property Variables”) via a queue of assignment requests.
| Quasi-Parallel Assignment Statements | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
The left hand side of the assignment must be a property variable, or a compile-time error occurs. The type of the right hand side must be assignable to the type of the property variable, or a compile-time error occurs. In addition, some operators have restrictions on the types of their operands.
The operators :+=,
:-=, :*=,
and :/=, are only defined
for numeric types. A statement of the form
p :-=
e; is treated as being the
statement p :+= -e;.
The operators :&=,
:|=, and :^=, are only defined
for integral types and boolean.
The meaning of the quasi-parallel assignment operators is similar to their normal counterparts without the colon prefix. Actually, this should be ensured by the implementation of run-time models (Section 3.2, “Run-Time Model”), because the semantics of these operators is implemented by run-time models. Namely, the execution of a quasi-parallel assignment statement is done as follows:
The current extended state x
(Chapter 4, Extended State of the Virtual Machine)
and the current queue collection c
(Section 3.2.2, “Current Queue Collection”) are determined.
The current property modification queue
q is determined by the method invocation
c.getPropertyModificationQueue().
If this returns null, a
NullPointerException is thrown.
The property variable of the left hand side is evaluated, i. e.,
the corresponding object o and the
run-time property p are determined
(Section 7.1, “Property Variables”, Section 16.5, “Bracket Access Expressions”).
This includes that indices of component properties are pushed onto
x's int-stack.
The right hand side is evaluated, resulting in a value
v.
The method q.m(o,
p, v)
is invoked. Its name m is constructed
as follows: Let A be the type affix
(Section 6.1, “Type Affixes and Type Letters”) of the type of the property, then the
method name is
setA for the operator
:=,
addA for the operator
:+=,
mulA for the operator
:*=,
divA for the operator
:/=,
andA for the operator
:&=,
orA for the operator
:|=,
xorA for the operator
:^=.
Note that quasi-parallel assignments are statements, while normal assignments are expressions.