Skip to content

sequential expression

Cameron Purdy edited this page Apr 8, 2020 · 1 revision

The SequentialExpression is a postfix expression used to increment or decrement an L-Value, such as a local variable, a property, or an element in an array. SequentialExpression uses the well-known forms:

a++
a--

Just like the pre-increment and pre-decrement operators on the PrefixExpression, neither ++ nor -- are an operator in the simple sense, because they incur an effect on an L-Value. In order to apply either of these operators, the compiler requires that the type of that L-Value be Sequential, which implies the presence of the methods nextValue() and prevValue().

The execution of the expression is an invocation of the selected operator method, against a target reference yielded by the expression a; the result of the expression is the return value from the operator method.

The expression short-circuits if a short-circuits.

The expression uses the default left-to-right definite assignment rules:

  • The VAS before a is the VAS before the expression.
  • The VAS after the expression is the VAS after a.
    SequentialExpression:
        PostfixExpression ++
        PostfixExpression --