add class tests to optional async transformers

This commit is contained in:
Sebastian McKenzie 2015-01-26 15:52:39 +11:00
parent 0a851ced19
commit a821b2249b
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,5 @@
class Foo {
async foo() {
var wat = await bar();
}
}

View File

@ -0,0 +1,22 @@
"use strict";
var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(gen.next); var callThrow = step.bind(gen["throw"]); function step(arg) { try { var info = this(arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; };
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var Foo = (function () {
function Foo() {}
_prototypeProperties(Foo, null, {
foo: {
value: _asyncToGenerator(function* () {
var wat = yield bar();
}),
writable: true,
enumerable: true,
configurable: true
}
});
return Foo;
})();

View File

@ -0,0 +1,5 @@
class Foo {
async foo() {
var wat = await bar();
}
}

View File

@ -0,0 +1,22 @@
"use strict";
var _bluebird = require("bluebird");
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var Foo = (function () {
function Foo() {}
_prototypeProperties(Foo, null, {
foo: {
value: _bluebird.coroutine(function* () {
var wat = yield bar();
}),
writable: true,
enumerable: true,
configurable: true
}
});
return Foo;
})();