mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
424 B
31 lines
424 B
/*
|
|
* Print a sum of pre/post increment and decrement operations on
|
|
* the same value. Ensures that temporary results are not incorrectly
|
|
* bound to the variable register (each value needs a temporary register
|
|
* because it may be further modified).
|
|
*/
|
|
|
|
/*===
|
|
19
|
|
===*/
|
|
|
|
x = 1;
|
|
|
|
print(
|
|
(++x) /* 2 */
|
|
+
|
|
(x++) /* 2 */
|
|
+
|
|
x /* 3 */
|
|
+
|
|
(++x) /* 4 */
|
|
+
|
|
(--x) /* 3 */
|
|
+
|
|
(x--) /* 3 */
|
|
+
|
|
x /* 2 */
|
|
|
|
/* = 19 */
|
|
);
|
|
|
|
|