From 388133642d0d573087742cb17179772a614cbdc5 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 13 Feb 2015 21:05:52 +1100 Subject: [PATCH] add support for UnaryExpression to getBindingIdentifiers and add it as a reassignment in the scope tracking --- lib/6to5/traversal/scope.js | 2 +- lib/6to5/types/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/6to5/traversal/scope.js b/lib/6to5/traversal/scope.js index f2f9691554..d8190a282d 100644 --- a/lib/6to5/traversal/scope.js +++ b/lib/6to5/traversal/scope.js @@ -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); } } diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index f11ed92e33..d65f5811f0 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -608,6 +608,7 @@ t.getBindingIdentifiers = function (node) { }; t.getBindingIdentifiers.keys = { + UnaryExpression: ["argument"], AssignmentExpression: ["left"], ImportBatchSpecifier: ["name"], VariableDeclarator: ["id"],