fix forOf loop inheritance - fixes #1169

This commit is contained in:
Sebastian McKenzie
2015-04-08 08:10:53 -07:00
parent 982c142bf6
commit 93feabb82e
3 changed files with 45 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
function foo() {
let input = ['a', 'b', 'c']
let output = {}
for (let c of input) {
let name = c
output[name] = name
}
return output
}

View File

@@ -0,0 +1,33 @@
'use strict';
function foo() {
var input = ['a', 'b', 'c'];
var output = {};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var c = _step.value;
var _name = c;
output[_name] = _name;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator['return']) {
_iterator['return']();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return output;