Example:
fn = ->>
for let v in [Promise.resolve 1]
await v
Result:
var fn;
fn = async function(){
var i$, ref$, len$, results$ = [], fn$ = function*(v){
return (await v);
};
for (i$ = 0, len$ = (ref$ = [Promise.resolve(1)]).length; i$ < len$; ++i$) {
results$.push((yield* (fn$.call(this, ref$[i$]))));
}
return results$;
};
Expected result:
var fn;
fn = async function(){
var i$, ref$, len$, results$ = [], fn$ = async function(v){
return (await v);
};
for (i$ = 0, len$ = (ref$ = [Promise.resolve(1)]).length; i$ < len$; ++i$) {
results$.push((await (fn$.call(this, ref$[i$]))));
}
return results$;
};
It seems the mechanism for yields is also used for awaits, but those require a special treatment.
I also noticed that asynchronous generator functions are not yet supported, so I couldn't test for that.
Example:
Result:
Expected result:
It seems the mechanism for
yields is also used forawaits, but those require a special treatment.I also noticed that asynchronous generator functions are not yet supported, so I couldn't test for that.