* 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
29 lines
552 B
JavaScript
29 lines
552 B
JavaScript
// ForXStatement
|
|
for (var _ref of []) {
|
|
var { a } = _ref,
|
|
b = babelHelpers.objectWithoutProperties(_ref, ["a"]);
|
|
}
|
|
for (var _ref2 of []) {
|
|
var { a } = _ref2,
|
|
b = babelHelpers.objectWithoutProperties(_ref2, ["a"]);
|
|
}
|
|
async function a() {
|
|
for await (var _ref3 of []) {
|
|
var { a } = _ref3,
|
|
b = babelHelpers.objectWithoutProperties(_ref3, ["a"]);
|
|
}
|
|
}
|
|
|
|
// skip
|
|
for ({ a } in {}) {}
|
|
for ({ a } of []) {}
|
|
async function a() {
|
|
for ({ a } of []) {}
|
|
}
|
|
|
|
for (a in {}) {}
|
|
for (a of []) {}
|
|
async function a() {
|
|
for (a of []) {}
|
|
}
|