v1.0 with SW PWA enabled
This commit is contained in:
16
frontend/node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
16
frontend/node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = void 0;
|
||||
var _renamer = require("./lib/renamer.js");
|
||||
var _index = require("../index.js");
|
||||
var _traverseForScope = require("./traverseForScope.js");
|
||||
var _binding = require("./binding.js");
|
||||
var _t = require("@babel/types");
|
||||
var t = _t;
|
||||
@ -186,6 +187,9 @@ function resetScope(scope) {
|
||||
scope.bindings = Object.create(null);
|
||||
scope.globals = Object.create(null);
|
||||
}
|
||||
function isAnonymousFunctionExpression(path) {
|
||||
return path.isFunctionExpression() && !path.node.id || path.isArrowFunctionExpression();
|
||||
}
|
||||
{
|
||||
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
|
||||
}
|
||||
@ -677,6 +681,7 @@ class Scope {
|
||||
}
|
||||
crawl() {
|
||||
const path = this.path;
|
||||
;
|
||||
resetScope(this);
|
||||
this.data = Object.create(null);
|
||||
let scope = this;
|
||||
@ -699,9 +704,6 @@ class Scope {
|
||||
}
|
||||
}, collectorVisitor]));
|
||||
if (path.type !== "Program") {
|
||||
for (const visit of scopeVisitor.enter) {
|
||||
visit.call(state, path, state);
|
||||
}
|
||||
const typeVisitors = scopeVisitor[path.type];
|
||||
if (typeVisitors) {
|
||||
for (const visit of typeVisitors.enter) {
|
||||
@ -709,7 +711,9 @@ class Scope {
|
||||
}
|
||||
}
|
||||
}
|
||||
path.traverse(scopeVisitor, state);
|
||||
{
|
||||
path.traverse(scopeVisitor, state);
|
||||
}
|
||||
this.crawling = false;
|
||||
for (const path of state.assignments) {
|
||||
const ids = path.getAssignmentIdentifiers();
|
||||
@ -747,7 +751,7 @@ class Scope {
|
||||
kind = "var",
|
||||
id
|
||||
} = opts;
|
||||
if (!init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && isCallExpression(path.parent, {
|
||||
if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path) && isCallExpression(path.parent, {
|
||||
callee: path.node
|
||||
}) && path.parent.arguments.length <= path.node.params.length && isIdentifier(id)) {
|
||||
path.pushContainer("params", id);
|
||||
@ -936,7 +940,7 @@ class Scope {
|
||||
emit(identifier(name), decl.init != null);
|
||||
}
|
||||
}
|
||||
if (parentPath.parentPath.isFor({
|
||||
if (parentPath.parentPath.isForXStatement({
|
||||
left: parent
|
||||
})) {
|
||||
parentPath.replaceWith(firstId);
|
||||
|
||||
Reference in New Issue
Block a user