rename t.getDeclarations to the WAY more reflective t.getBindingIdentifiers

This commit is contained in:
Sebastian McKenzie
2015-02-03 12:03:21 +11:00
parent 706797eb47
commit b2ad79cf88
4 changed files with 10 additions and 13 deletions

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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];

View File

@@ -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"],