This is undefined behavior and not covered by the Jack language specification. Therefore there is no wrong or right here, it is implementation-dependent. Such corner cases - in this case side effects - are typically considered as bad programming style and should be avoided generally due to its semantic ambiguity.
This is not just a Jack-specific topic, it is common in many languages to have undefined behavior. See for example a long list in the draft for the new
ISO draft for C programming language under Appendix J.2 pages 579-589.
Edit: A similar case is actually covered by J.1 in the ISO C standard:
Unspecified behavior:
— The order in which subexpressions are evaluated and the order in which side effects take place,
except as specified for the function-call (), &&, ||, ?:, and comma operators (6.5).
— The order in which the function designator, arguments, and subexpressions within the arguments are evaluated in a function call (6.5.2.2).
— The order of side effects among compound literal initialization list expressions (6.5.2.5).
— The order in which the operands of an assignment operator are evaluated (6.5.16).