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) {
|
||||
path.replaceWith(node.declaration);
|
||||
path.insertAfter(
|
||||
t.exportNamedDeclaration(null, [
|
||||
t.exportSpecifier(ref, t.identifier("default")),
|
||||
t.exportSpecifier(t.cloneNode(ref), t.identifier("default")),
|
||||
]),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class LooseClassTransformer extends VanillaTransformer {
|
||||
classRef = this._protoAlias;
|
||||
}
|
||||
const methodName = t.memberExpression(
|
||||
classRef,
|
||||
t.cloneNode(classRef),
|
||||
node.key,
|
||||
node.computed || t.isLiteral(node.key),
|
||||
);
|
||||
|
||||
@@ -387,12 +387,12 @@ export default class ClassTransformer {
|
||||
// special case single arguments spread
|
||||
bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument;
|
||||
bareSuperNode.callee = t.memberExpression(
|
||||
superRef,
|
||||
t.cloneNode(superRef),
|
||||
t.identifier("apply"),
|
||||
);
|
||||
} else {
|
||||
bareSuperNode.callee = t.memberExpression(
|
||||
superRef,
|
||||
t.cloneNode(superRef),
|
||||
t.identifier("call"),
|
||||
);
|
||||
}
|
||||
@@ -456,7 +456,7 @@ export default class ClassTransformer {
|
||||
const superRef = this.superName || t.identifier("Function");
|
||||
let thisRef = function() {
|
||||
const ref = path.scope.generateDeclaredUidIdentifier("this");
|
||||
thisRef = () => ref;
|
||||
thisRef = () => t.cloneNode(ref);
|
||||
return ref;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user