-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Using tink_await 0.6.0, oldschool anonymous functions work as expected, but arrowfunctions don't - the return value isn't unpacked correctly. Noticed when trying Future.ofJsPromise as below, but the same seems to happen when using all Futures:
@await class Main {
@async static function main() {
// This works fine:
js.Browser.document.onmousedown = @async function(e) {
var int = @await Future.ofJsPromise(testJsPromise());
trace(int); // traces 1234
};
// This doesn't:
js.Browser.document.onmousedown = @async (e)-> {
var int = @await Future.ofJsPromise(testJsPromise());
trace(int); // traces the promise method
};
}
static function testJsPromise():Promise<Int> {
return new Promise<Int>((res, rej)->{
haxe.Timer.delay(()->res(1234), 1000);
});
}
}
cedx
Metadata
Metadata
Assignees
Labels
No labels