clean up t.getIds

This commit is contained in:
Sebastian McKenzie
2015-01-28 23:41:42 +11:00
parent 2d8944fbd5
commit 962eeed252

View File

@@ -490,7 +490,11 @@ t.toBlock = function (node, parent) {
};
/**
* Description
* 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.
*
* @param {Object} node
* @param {Boolean} [map]
@@ -499,15 +503,15 @@ t.toBlock = function (node, parent) {
*/
t.getIds = function (node, map, ignoreTypes) {
ignoreTypes = ignoreTypes || [];
var search = [].concat(node);
var ids = object();
while (search.length) {
var id = search.shift();
if (!id) continue;
if (_.contains(ignoreTypes, id.type)) 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];