Skip to content

Instantly share code, notes, and snippets.

@Gerhut
Created July 9, 2015 11:57
Show Gist options
  • Select an option

  • Save Gerhut/0a5b94f81b84617ac23c to your computer and use it in GitHub Desktop.

Select an option

Save Gerhut/0a5b94f81b84617ac23c to your computer and use it in GitHub Desktop.
Babel compiler bug with for..of & System.js module
function* a() {
yield 1
yield 2
yield 3
}
for (let b of a()) {
console.log(b)
}
"use strict";
var marked0$0 = [a].map(regeneratorRuntime.mark);
function a() {
return regeneratorRuntime.wrap(function a$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
context$1$0.next = 2;
return 1;
case 2:
context$1$0.next = 4;
return 2;
case 4:
context$1$0.next = 6;
return 3;
case 6:
case "end":
return context$1$0.stop();
}
}, marked0$0[0], this);
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = a()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var b = _step.value;
console.log(b);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
System.register([], function (_export) {
"use strict";
var marked0$0, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b;
function a() {
return regeneratorRuntime.wrap(function a$(context$1$0) {
while (1) switch (context$1$0.prev = context$1$0.next) {
case 0:
context$1$0.next = 2;
return 1;
case 2:
context$1$0.next = 4;
return 2;
case 4:
context$1$0.next = 6;
return 3;
case 6:
case "end":
return context$1$0.stop();
}
}, marked0$0[0], this);
}
return {
setters: [],
execute: function () {
marked0$0 = [a].map(regeneratorRuntime.mark);
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
try {
for (_iterator; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
b = _step.value;
console.log(b);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment