From 01bdb7efdcb1a8f676dc33e1e2fdafb24b40b479 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 16 Dec 2014 08:07:18 +1100 Subject: [PATCH] fix export and import specifier getIds and add support for computed properties to isReferenced --- lib/6to5/types/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 65fb12bedc..d4b95ee677 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -128,8 +128,8 @@ t.isDynamic = function (node) { }; t.isReferenced = function (node, parent) { - // we're a property key so we aren't referenced - if (t.isProperty(parent) && parent.key === node) return false; + // we're a property key and we aren't computed so we aren't referenced + if (t.isProperty(parent) && parent.key === node && !parent.computed) return false; // we're a variable declarator id so we aren't referenced if (t.isVariableDeclarator(parent) && parent.id === node) return false; @@ -256,8 +256,8 @@ t.getIds = function (node, map, ignoreTypes) { t.getIds.nodes = { AssignmentExpression: "left", - ImportSpecifier: "id", - ExportSpecifier: "id", + ImportSpecifier: "name", + ExportSpecifier: "name", VariableDeclarator: "id", FunctionDeclaration: "id", ClassDeclaration: "id",