update deps
This commit is contained in:
26
node_modules/acorn-globals/index.js
generated
vendored
26
node_modules/acorn-globals/index.js
generated
vendored
@@ -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;
|
||||
}
|
||||
@@ -114,19 +120,21 @@ function findGlobals(source, options) {
|
||||
'ClassDeclaration': function (node, parents) {
|
||||
var parent = null;
|
||||
for (var i = parents.length - 2; i >= 0 && parent === null; i--) {
|
||||
if (isScope(parents[i])) {
|
||||
if (isBlockScope(parents[i])) {
|
||||
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] || []);
|
||||
|
Reference in New Issue
Block a user