Class AssignmentPreMutation

  • All Implemented Interfaces:
    HasByteCodeLoc, DeepCloneable<Statement>, Statement, ComparableUnderEC, Dumpable

    public class AssignmentPreMutation
    extends AbstractAssignment
    In an assignment prechange, the LHS is by definition equal to the RHS after the statement. I.e. x = ++x;

    y = y|=3;

    We can always drop the assignment, and just display this as the expression.

    As the name implies, this is not appropriate for postchanges, i.e. x++; In order to do those, we will have a copy of the value before increment. So we'll see

    i = x; x = ++x; // (with our daft AssignmentMutation). if (i ... )

    If we have a guaranteed single use of a pre-change, we can run it together with the PRIOR use, and convert it to a post change. Similarly, if we have a SINGLE use of a prechange AFTER, we can just move the prechange RHS.

    x = ++x; if (x ) ......