Fix reused nodes - part 1 (#7149)
This commit is contained in:
committed by
Nicolò Ribaudo
parent
63ae923987
commit
912bcc186d
@@ -34,7 +34,7 @@ export default function(api, options) {
|
||||
t.assignmentExpression(
|
||||
"=",
|
||||
t.memberExpression(
|
||||
objId,
|
||||
t.cloneNode(objId),
|
||||
prop.key,
|
||||
prop.computed || t.isLiteral(prop.key),
|
||||
),
|
||||
@@ -62,7 +62,7 @@ export default function(api, options) {
|
||||
body.push(
|
||||
...buildMutatorMapAssign({
|
||||
MUTATOR_MAP_REF: getMutatorId(),
|
||||
KEY: key,
|
||||
KEY: t.cloneNode(key),
|
||||
VALUE: getValue(prop),
|
||||
KIND: t.identifier(prop.kind),
|
||||
}),
|
||||
@@ -74,7 +74,7 @@ export default function(api, options) {
|
||||
if (prop.kind === "get" || prop.kind === "set") {
|
||||
pushMutatorDefine(info, prop);
|
||||
} else {
|
||||
pushAssign(info.objId, prop, info.body);
|
||||
pushAssign(t.cloneNode(info.objId), prop, info.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export default function(api, options) {
|
||||
body.push(
|
||||
t.expressionStatement(
|
||||
t.callExpression(state.addHelper("defineProperty"), [
|
||||
objId,
|
||||
t.cloneNode(objId),
|
||||
key,
|
||||
getValue(prop),
|
||||
]),
|
||||
@@ -165,7 +165,7 @@ export default function(api, options) {
|
||||
);
|
||||
}
|
||||
|
||||
return mutatorRef;
|
||||
return t.cloneNode(mutatorRef);
|
||||
};
|
||||
|
||||
const single = pushComputedProps({
|
||||
@@ -183,7 +183,7 @@ export default function(api, options) {
|
||||
t.expressionStatement(
|
||||
t.callExpression(
|
||||
state.addHelper("defineEnumerableProperties"),
|
||||
[objId, mutatorRef],
|
||||
[t.cloneNode(objId), t.cloneNode(mutatorRef)],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -192,7 +192,7 @@ export default function(api, options) {
|
||||
if (single) {
|
||||
path.replaceWith(single);
|
||||
} else {
|
||||
body.push(t.expressionStatement(objId));
|
||||
body.push(t.expressionStatement(t.cloneNode(objId)));
|
||||
path.replaceWithMultiple(body);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user