This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

44
node_modules/@babel/parser/lib/plugins/flow/scope.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _scope = require("../../util/scope");
var _scopeflags = require("../../util/scopeflags");
class FlowScope extends _scope.Scope {
constructor(...args) {
super(...args);
this.declareFunctions = new Set();
}
}
class FlowScopeHandler extends _scope.default {
createScope(flags) {
return new FlowScope(flags);
}
declareName(name, bindingType, loc) {
const scope = this.currentScope();
if (bindingType & _scopeflags.BindingFlag.FLAG_FLOW_DECLARE_FN) {
this.checkRedeclarationInScope(scope, name, bindingType, loc);
this.maybeExportDefined(scope, name);
scope.declareFunctions.add(name);
return;
}
super.declareName(name, bindingType, loc);
}
isRedeclaredInScope(scope, name, bindingType) {
if (super.isRedeclaredInScope(scope, name, bindingType)) return true;
if (bindingType & _scopeflags.BindingFlag.FLAG_FLOW_DECLARE_FN) {
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
}
return false;
}
checkLocalExport(id) {
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
super.checkLocalExport(id);
}
}
}
exports.default = FlowScopeHandler;
//# sourceMappingURL=scope.js.map