rename t.getDeclarations to the WAY more reflective t.getBindingIdentifiers
This commit is contained in:
@@ -45,7 +45,7 @@ var exportsVisitor = {
|
||||
formatter.hasLocalImports = true;
|
||||
|
||||
if (declar && t.isStatement(declar)) {
|
||||
extend(formatter.localExports, t.getDeclarations(declar));
|
||||
extend(formatter.localExports, t.getBindingIdentifiers(declar));
|
||||
}
|
||||
|
||||
if (!node.default) {
|
||||
@@ -67,7 +67,7 @@ var importsVisitor = {
|
||||
enter: function (node, parent, scope, context, formatter) {
|
||||
if (t.isImportDeclaration(node)) {
|
||||
formatter.hasLocalImports = true;
|
||||
extend(formatter.localImports, t.getDeclarations(node));
|
||||
extend(formatter.localImports, t.getBindingIdentifiers(node));
|
||||
formatter.bumpImportOccurences(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ BlockScoping.prototype.getLetReferences = function () {
|
||||
//
|
||||
for (var i = 0; i < declarators.length; i++) {
|
||||
declar = declarators[i];
|
||||
extend(this.outsideLetReferences, t.getDeclarations(declar));
|
||||
extend(this.outsideLetReferences, t.getBindingIdentifiers(declar));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -274,7 +274,7 @@ BlockScoping.prototype.getLetReferences = function () {
|
||||
//
|
||||
for (i = 0; i < declarators.length; i++) {
|
||||
declar = declarators[i];
|
||||
var keys = t.getDeclarations(declar);
|
||||
var keys = t.getBindingIdentifiers(declar);
|
||||
extend(this.letReferences, keys);
|
||||
this.hasLetReferences = true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ Scope.defaultDeclarations = flatten([globals.builtin, globals.browser, globals.n
|
||||
Scope.prototype._add = function (node, references, throwOnDuplicate) {
|
||||
if (!node) return;
|
||||
|
||||
var ids = t.getDeclarations(node);
|
||||
var ids = t.getBindingIdentifiers(node);
|
||||
|
||||
for (var key in ids) {
|
||||
var id = ids[key];
|
||||
|
||||
@@ -560,17 +560,14 @@ t.toBlock = function (node, parent) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a list of identifiers that will be assigned
|
||||
* as a result of runtime evaluation.
|
||||
*
|
||||
* If an identifier is passed as `node` instead of a
|
||||
* declaration then it's assumed to be an assignable.
|
||||
* Return a list of binding identifiers associated with
|
||||
* the input `node`.
|
||||
*
|
||||
* @param {Object} node
|
||||
* @returns {Array|Object}
|
||||
*/
|
||||
|
||||
t.getDeclarations = function (node) {
|
||||
t.getBindingIdentifiers = function (node) {
|
||||
var search = [].concat(node);
|
||||
var ids = object();
|
||||
|
||||
@@ -578,7 +575,7 @@ t.getDeclarations = function (node) {
|
||||
var id = search.shift();
|
||||
if (!id) continue;
|
||||
|
||||
var keys = t.getDeclarations.keys[id.type];
|
||||
var keys = t.getBindingIdentifiers.keys[id.type];
|
||||
|
||||
if (t.isIdentifier(id)) {
|
||||
ids[id.name] = id;
|
||||
@@ -597,7 +594,7 @@ t.getDeclarations = function (node) {
|
||||
return ids;
|
||||
};
|
||||
|
||||
t.getDeclarations.keys = {
|
||||
t.getBindingIdentifiers.keys = {
|
||||
AssignmentExpression: ["left"],
|
||||
ImportBatchSpecifier: ["name"],
|
||||
ImportSpecifier: ["name", "id"],
|
||||
|
||||
Reference in New Issue
Block a user