mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* fix: Preserve computed key evaluation order in nested object rest (#17274) * fix: use inline memoization for computed keys to preserve eval order * test: use distinct values to properly validate computed key ordering fix * docs: update comments to reflect inline memoization approach * refactor: remove redundant state flags and AST mutations * fix: only memoize computed keys when rest elements are present * refactor: address review feedback
12 lines
339 B
JavaScript
12 lines
339 B
JavaScript
// Computed keys must be evaluated in source order (left-to-right)
|
|
// even when nested object rest is involved. This test verifies
|
|
// that log(0), log(1), log(2), log(3) execute in that order.
|
|
|
|
function log(n) {
|
|
console.log(n);
|
|
return "x";
|
|
}
|
|
|
|
const { [log(0)]: { [log(1)]: x, [log(2)]: y, ...rest }, [log(3)]: z } = { x: { x: {} } };
|
|
|