From 4b525daf72c6a5002f74d7969a11fc62cb41c95f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 20 Jan 2015 19:33:05 +1100 Subject: [PATCH] fix forOf scope declarations not propagating to new for loop - fixes #538 --- lib/6to5/transformation/transformers/es6-for-of.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/6to5/transformation/transformers/es6-for-of.js b/lib/6to5/transformation/transformers/es6-for-of.js index 3eed21d15d..3e3f9ac0f3 100644 --- a/lib/6to5/transformation/transformers/es6-for-of.js +++ b/lib/6to5/transformation/transformers/es6-for-of.js @@ -30,6 +30,9 @@ exports.ForOfStatement = function (node, parent, scope, context, file) { // push the rest of the original loop body onto our new body block.body = block.body.concat(node.body.body); + // todo: find out why this is necessary? #538 + loop._scopeInfo = node._scopeInfo; + return loop; };