This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

24
node_modules/acorn-globals/index.js generated vendored
View File

@@ -46,7 +46,7 @@ function findGlobals(source, options) {
}
var declareFunction = function (node) {
var fn = node;
fn.locals = fn.locals || {};
fn.locals = fn.locals || Object.create(null);
node.params.forEach(function (node) {
declarePattern(node, fn);
});
@@ -54,6 +54,12 @@ function findGlobals(source, options) {
fn.locals[node.id.name] = true;
}
};
var declareClass = function (node) {
node.locals = node.locals || Object.create(null);
if (node.id) {
node.locals[node.id.name] = true;
}
};
var declarePattern = function (node, parent) {
switch (node.type) {
case 'Identifier':
@@ -81,7 +87,7 @@ function findGlobals(source, options) {
}
};
var declareModuleSpecifier = function (node, parents) {
ast.locals = ast.locals || {};
ast.locals = ast.locals || Object.create(null);
ast.locals[node.local.name] = true;
};
walk.ancestor(ast, {
@@ -92,7 +98,7 @@ function findGlobals(source, options) {
parent = parents[i];
}
}
parent.locals = parent.locals || {};
parent.locals = parent.locals || Object.create(null);
node.declarations.forEach(function (declaration) {
declarePattern(declaration.id, parent);
});
@@ -104,7 +110,7 @@ function findGlobals(source, options) {
parent = parents[i];
}
}
parent.locals = parent.locals || {};
parent.locals = parent.locals || Object.create(null);
if (node.id) {
parent.locals[node.id.name] = true;
}
@@ -118,15 +124,17 @@ function findGlobals(source, options) {
parent = parents[i];
}
}
parent.locals = parent.locals || {};
parent.locals = parent.locals || Object.create(null);
if (node.id) {
parent.locals[node.id.name] = true;
}
declareClass(node);
},
'Class': declareClass,
'TryStatement': function (node) {
if (node.handler === null) return;
node.handler.locals = node.handler.locals || {};
node.handler.locals[node.handler.param.name] = true;
node.handler.locals = node.handler.locals || Object.create(null);
declarePattern(node.handler.param, node.handler);
},
'ImportDefaultSpecifier': declareModuleSpecifier,
'ImportSpecifier': declareModuleSpecifier,
@@ -159,7 +167,7 @@ function findGlobals(source, options) {
globals.push(node);
}
});
var groupedGlobals = {};
var groupedGlobals = Object.create(null);
globals.forEach(function (node) {
var name = node.type === 'ThisExpression' ? 'this' : node.name;
groupedGlobals[name] = (groupedGlobals[name] || []);