* avoid duplicating impure initializers in object rest destructuring * reuse existing VariableDeclarations in object rest destructuring, to fix two issues: 1. inserting an additional VariableDeclaration after the current one may change order of operations, which is unsafe if a future VariableDeclarator refers to a destructured variable. 2. The entire VariableDeclaration is removed when all properties are rest properties, indiscriminately removing other variables
15 lines
386 B
JavaScript
15 lines
386 B
JavaScript
const { x } = a,
|
|
y = babelHelpers.objectWithoutProperties(a, ["x"]),
|
|
z = foo(y);
|
|
|
|
const s = babelHelpers.objectWithoutProperties(r, []),
|
|
t = foo(s);
|
|
|
|
// ordering is preserved
|
|
var l = foo(),
|
|
_bar = bar(),
|
|
{ m: { n } } = _bar,
|
|
o = babelHelpers.objectWithoutProperties(_bar.m, ["n"]),
|
|
p = babelHelpers.objectWithoutProperties(_bar, ["m"]),
|
|
q = baz();
|