add support for UnaryExpression to getBindingIdentifiers and add it as a reassignment in the scope tracking

This commit is contained in:
Sebastian McKenzie
2015-02-13 21:05:52 +11:00
parent 23b5eeb72f
commit 388133642d
2 changed files with 2 additions and 1 deletions

View File

@@ -418,7 +418,7 @@ var programReferenceVisitor = {
state.addGlobal(node);
} else if (t.isLabeledStatement(node)) {
state.addGlobal(node);
} else if (t.isAssignmentExpression(node) || t.isUpdateExpression(node)) {
} else if (t.isAssignmentExpression(node) || t.isUpdateExpression(node) || (t.isUnaryExpression(node) && node.operator === "delete")) {
scope.registerBindingReassignment(node);
}
}

View File

@@ -608,6 +608,7 @@ t.getBindingIdentifiers = function (node) {
};
t.getBindingIdentifiers.keys = {
UnaryExpression: ["argument"],
AssignmentExpression: ["left"],
ImportBatchSpecifier: ["name"],
VariableDeclarator: ["id"],