From 031bda61cc9a4efc29fafbe6ea8dd0e3a7ead4a4 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 20 Jan 2015 16:48:07 +1100 Subject: [PATCH] don't continue let scoping remapping if there are none to be remapped --- .../transformation/transformers/es6-let-scoping.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/6to5/transformation/transformers/es6-let-scoping.js b/lib/6to5/transformation/transformers/es6-let-scoping.js index 4d0f13910e..044be99030 100644 --- a/lib/6to5/transformation/transformers/es6-let-scoping.js +++ b/lib/6to5/transformation/transformers/es6-let-scoping.js @@ -117,9 +117,10 @@ LetScoping.prototype.run = function () { */ LetScoping.prototype.remap = function () { - var letRefs = this.letReferences; - var scope = this.scope; - var file = this.file; + var hasRemaps = false; + var letRefs = this.letReferences; + var scope = this.scope; + var file = this.file; // alright, so since we aren't wrapping this block in a closure // we have to check if any of our let variables collide with @@ -136,6 +137,7 @@ LetScoping.prototype.remap = function () { var uid = file.generateUidIdentifier(ref.name, scope).name; ref.name = uid; + hasRemaps = true; remaps[key] = remaps[uid] = { node: ref, uid: uid @@ -143,6 +145,8 @@ LetScoping.prototype.remap = function () { } } + if (!hasRemaps) return; + // var replace = function (node, parent, scope, context, remaps) {