use simple loops always in array comprehensions, support yield inside of array comprehensions - closes #325, fixes #252

This commit is contained in:
Sebastian McKenzie
2015-01-02 02:14:36 +11:00
parent f1a178f8f9
commit ba67f57c1e
10 changed files with 83 additions and 76 deletions

View File

@@ -1,15 +1,18 @@
"use strict";
var _toArray = function (arr) {
return Array.isArray(arr) ? arr : _core.Array.from(arr);
};
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var _core = _interopRequire(require("core-js/library"));
var arr = _toArray(nums).map(function (i) {
return i * i;
});
var arr = (function () {
var _arr = [];
for (var _iterator = _core.$for.getIterator(nums), _step; !(_step = _iterator.next()).done;) {
var i = _step.value;
_arr.push(i * i);
}
return _arr;
})();