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

10 lines
378 B
JavaScript

const v1 = (effects.push(1), null)?.[effects.push(2), 0][effects.push(3), 0];
const v2 = (effects.push(4), [{
x: 1
}])?.[effects.push(5), 0]?.x;
const v3 = (effects.push(6), [])[effects.push(7), 0]?.();
const v4 = (effects.push(8), null)?.[effects.push(9), 0](effects.push(10));
const v5 = (effects.push(11), {
s: x => (effects.push(12), x)
}).s?.((effects.push(13), 'a'));