Skip to content

Commit

Permalink
Fix scope
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Feb 13, 2021
1 parent 502b2fb commit 0ebce22
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/babel-parser/src/util/scope.js
Expand Up @@ -174,14 +174,13 @@ export default class ScopeHandler<IScope: Scope = Scope> {
}

checkLocalExport(id: N.Identifier) {
const scope = this.currentScope();
if (
scope.lexical.indexOf(id.name) === -1 &&
scope.var.indexOf(id.name) === -1 &&
this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
this.scopeStack[0].var.indexOf(id.name) === -1 &&
// In strict mode, scope.functions will always be empty.
// Modules are strict by default, but the `scriptMode` option
// can overwrite this behavior.
scope.functions.indexOf(id.name) === -1
this.scopeStack[0].functions.indexOf(id.name) === -1
) {
this.undefinedExports.set(id.name, id.start);
}
Expand Down

0 comments on commit 0ebce22

Please sign in to comment.