remap UpdateExpression in module exports - closes #334

This commit is contained in:
Sebastian McKenzie
2014-12-28 01:00:53 +11:00
parent e6ac5eccd0
commit 601bbb86cd
15 changed files with 80 additions and 23 deletions

View File

@@ -240,14 +240,17 @@ t.getIds = function (node, map, ignoreTypes) {
if (_.contains(ignoreTypes, id.type)) continue;
var nodeKey = t.getIds.nodes[id.type];
var arrKey = t.getIds.arrays[id.type];
var arrKeys = t.getIds.arrays[id.type];
if (t.isIdentifier(id)) {
ids[id.name] = id;
} else if (nodeKey) {
if (id[nodeKey]) search.push(id[nodeKey]);
} else if (arrKey) {
search = search.concat(id[arrKey] || []);
} else if (arrKeys) {
for (var i in arrKeys) {
var key = arrKeys[i];
search = search.concat(id[key] || []);
}
}
}
@@ -268,11 +271,11 @@ t.getIds.nodes = {
};
t.getIds.arrays = {
ExportDeclaration: "specifiers",
ImportDeclaration: "specifiers",
VariableDeclaration: "declarations",
ArrayPattern: "elements",
ObjectPattern: "properties"
ExportDeclaration: ["specifiers", "declaration"],
ImportDeclaration: ["specifiers"],
VariableDeclaration: ["declarations"],
ArrayPattern: ["elements"],
ObjectPattern: ["properties"]
};
t.isLet = function (node) {