Files
Huáng JùnliàngandGitHub 26af3161e6 Optimize do expression output (#17444)
* add new test case

* opt: conditionally apply the flatten transform

Only apply the flatten transform when the do expression contains Break/Continue/Return. This enables us to optimize the output since we don't have to memoize intermediate results.

* update test outputs

* remove unreachable code

variable declaration within for in/of can not have initializer.

* update test case to cover spread element

* add more test cases for early exit scenario

* make node 6 happy

* revert complex variable declaration removal
2025-07-25 14:29:47 -04:00

23 lines
392 B
JavaScript

for (let i = (effects.push(1), 0); i < (effects.push(2), 3); effects.push(4), i++) {
effects.push(3);
}
for (let i in effects.push(1), {
x: 1,
y: 2
}) {
effects.push(i);
}
for (let i of (effects.push(1), [2, 3])) {
effects.push(i);
}
let x = 0;
while (effects.push(1), x < 3) {
effects.push(2);
x++;
}
let y = 0;
do {
effects.push(1);
y++;
} while (effects.push(2), y < 3);