don't continue let scoping remapping if there are none to be remapped

This commit is contained in:
Sebastian McKenzie
2015-01-20 16:48:07 +11:00
parent 61f1fae83b
commit 031bda61cc

View File

@@ -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) {