From 146c2a56be4993ef719397acd68da1c48e53f07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 7 Oct 2022 17:38:37 +0200 Subject: [PATCH] Fix CI error --- packages/babel-traverse/src/scope/binding.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/babel-traverse/src/scope/binding.ts b/packages/babel-traverse/src/scope/binding.ts index dae019696e7b..6f70f74242c6 100644 --- a/packages/babel-traverse/src/scope/binding.ts +++ b/packages/babel-traverse/src/scope/binding.ts @@ -44,7 +44,22 @@ export default class Binding { this.path = path; this.kind = kind; - if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) { + if ( + (kind === "var" || kind === "hoisted") && + // For some reason, rollup removes the path argument from this + // call. Add an unreachable IIFE (that rollup doesn't know is + // unreachable) with side effects, to prevent it from messing + // up with arguments. + // You can reproduce this with + // BABEL_8_BREAKING=true make prepublish-build + // TODO(@nicolo-ribaudo): Investigate. + isDeclaredInLoop( + path || + (() => { + throw new Error("Internal Babel error: unreachable "); + })(), + ) + ) { this.reassign(path); }