Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not consider arguments in a helper as a global reference #16268

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/babel-helpers/src/index.ts
Expand Up @@ -110,7 +110,9 @@ function getHelperMetadata(file: File): HelperMetadata {
const name = child.node.name;
const binding = child.scope.getBinding(name);
if (!binding) {
globals.add(name);
if (name !== "arguments" || child.scope.path.isProgram()) {
globals.add(name);
}
} else if (dependencies.has(binding.identifier)) {
importBindingsReferences.push(makePath(child));
}
Expand Down
@@ -0,0 +1 @@
var arguments;
@@ -0,0 +1,3 @@
{
"plugins": ["./plugin"]
}
@@ -0,0 +1,2 @@
function _assertClassBrand(e, t, n) { if ("function" == typeof t ? t === e : t.has(e)) return arguments.length < 3 ? e : n; throw new TypeError("Private element is not present on this object"); }
var arguments;
@@ -0,0 +1,9 @@
export default function () {
return {
visitor: {
Program(path, file) {
file.addHelper("assertClassBrand");
},
},
};
}