Disallow duplicated AST nodes (#11807)

This commit is contained in:
Huáng Jùnliàng
2020-07-14 09:32:16 -04:00
committed by GitHub
parent ffb42488ba
commit 5dd64ecc4a
24 changed files with 85 additions and 62 deletions

View File

@@ -30,7 +30,7 @@ const buildOptimizedSequenceExpression = ({ assign, call, path }) => {
call.callee = evalSequence;
path.scope.push({ id: placeholderNode });
path.scope.push({ id: t.cloneNode(placeholderNode) });
return t.sequenceExpression([assign, call]);
}
@@ -40,7 +40,7 @@ const buildOptimizedSequenceExpression = ({ assign, call, path }) => {
return t.sequenceExpression([pipelineLeft, calledExpression.body]);
}
path.scope.push({ id: placeholderNode });
path.scope.push({ id: t.cloneNode(placeholderNode) });
if (param) {
path.get("right").scope.rename(param.name, placeholderNode.name);

View File

@@ -2,7 +2,7 @@ import { types as t } from "@babel/core";
const updateTopicReferenceVisitor = {
PipelinePrimaryTopicReference(path) {
path.replaceWith(this.topicId);
path.replaceWith(t.cloneNode(this.topicId));
},
PipelineTopicExpression(path) {
path.skip();