[babel 8] Do not skip requeued paths (#13291)
This commit is contained in:
@@ -27,6 +27,8 @@ function isReference(node, scope, state) {
|
||||
return scope.getBindingIdentifier(node.name) === declared;
|
||||
}
|
||||
|
||||
const visitedMaybeTDZNodes = new WeakSet();
|
||||
|
||||
export const visitor = {
|
||||
ReferencedIdentifier(path, state) {
|
||||
if (!state.tdzEnabled) return;
|
||||
@@ -44,13 +46,15 @@ export const visitor = {
|
||||
if (status === "outside") return;
|
||||
|
||||
if (status === "maybe") {
|
||||
if (visitedMaybeTDZNodes.has(node)) {
|
||||
return;
|
||||
}
|
||||
visitedMaybeTDZNodes.add(node);
|
||||
const assert = buildTDZAssert(node, state);
|
||||
|
||||
// add tdzThis to parent variable declarator so it's exploded
|
||||
bindingPath.parent._tdzThis = true;
|
||||
|
||||
path.skip();
|
||||
|
||||
if (path.parentPath.isUpdateExpression()) {
|
||||
if (parent._ignoreBlockScopingTDZ) return;
|
||||
path.parentPath.replaceWith(t.sequenceExpression([assert, parent]));
|
||||
|
||||
Reference in New Issue
Block a user