Use exec style test in transform-regenerator

This commit is contained in:
Jason 2016-01-23 23:30:52 +08:00
parent bbdd4aaf21
commit 35463a46b6
3 changed files with 8 additions and 32 deletions

View File

@ -1,3 +0,0 @@
class C {
*method(arg = this) {}
}

View File

@ -0,0 +1,8 @@
class Test {
*iter(arg = this) {
yield arg;
}
}
let test = new Test;
assert.equal(test.iter().next().value, test);

View File

@ -1,29 +0,0 @@
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var C = function () {
function C() {
_classCallCheck(this, C);
}
_createClass(C, [{
key: "method",
value: regeneratorRuntime.mark(function method() {
var arg = arguments.length <= 0 || arguments[0] === undefined ? this : arguments[0];
return regeneratorRuntime.wrap(function method$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, method, this);
})
}]);
return C;
}();