Ensure that the async/generator flags carry over when converting class methods - fixes T6755

This commit is contained in:
Logan Smyth
2015-12-05 12:24:00 -08:00
parent 412c65deb3
commit 03f189fc46
4 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
class Example {
async test1(){
await Promise.resolve(2);
}
*test2(){
yield 3;
}
}

View File

@@ -0,0 +1,30 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Example = (function () {
function Example() {
_classCallCheck(this, Example);
}
Example.prototype.test1 = async function test1() {
await Promise.resolve(2);
};
Example.prototype.test2 = regeneratorRuntime.mark(function test2() {
return regeneratorRuntime.wrap(function test2$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return 3;
case 2:
case "end":
return _context.stop();
}
}
}, test2, this);
});
return Example;
})();

View File

@@ -0,0 +1,6 @@
{
"plugins": [
"syntax-async-functions",
["transform-es2015-classes", { "loose": true }]
]
}