rename t.getIds to t.getDeclarations and remove dead code

This commit is contained in:
Sebastian McKenzie
2015-01-30 21:36:51 +11:00
parent f325d3b065
commit 0fea437536
5 changed files with 11 additions and 17 deletions

View File

@@ -502,12 +502,10 @@ t.toBlock = function (node, parent) {
* declaration then it's assumed to be an assignable.
*
* @param {Object} node
* @param {Boolean} [map]
* @param {Array} [ignoreTypes]
* @returns {Array|Object}
*/
t.getIds = function (node, map, ignoreTypes) {
t.getDeclarations = function (node) {
var search = [].concat(node);
var ids = object();
@@ -515,11 +513,8 @@ t.getIds = function (node, map, ignoreTypes) {
var id = search.shift();
if (!id) continue;
// blacklist types
if (ignoreTypes && ignoreTypes.indexOf(id.type) >= 0) continue;
var nodeKeys = t.getIds.nodes[id.type];
var arrKeys = t.getIds.arrays[id.type];
var nodeKeys = t.getDeclarations.nodes[id.type];
var arrKeys = t.getDeclarations.arrays[id.type];
var i, key;
@@ -545,11 +540,10 @@ t.getIds = function (node, map, ignoreTypes) {
}
}
if (!map) ids = keys(ids);
return ids;
};
t.getIds.nodes = {
t.getDeclarations.nodes = {
AssignmentExpression: ["left"],
ImportBatchSpecifier: ["name"],
ImportSpecifier: ["name", "id"],
@@ -565,7 +559,7 @@ t.getIds.nodes = {
AssignmentPattern: ["left"]
};
t.getIds.arrays = {
t.getDeclarations.arrays = {
PrivateDeclaration: ["declarations"],
ComprehensionExpression: ["blocks"],
ImportDeclaration: ["specifiers"],