Open kevinresol opened 7 years ago
That means we'd have to check all expressions of every method to see if it contains the metadata. But if this is something you regularly need, we could enable it behind a flag and see how it goes?
Or introducing another meta besides await
and async
which is used to only indicate there are something to get transformed inside?
That's what @:await
on a method is already there for?
@:await
class Await {
@:await function wrapper() {
@:async function local() {
return @:await something();
}
// ... use local ...
}
}
Oh I thought @:await
forces the function to return Void
. If that's not the case, this can be closed.
It doesn't :) It works as you proposed:
to only indicate there are something to get transformed inside
I've added a test here, but let's keep this open so I can add some info in the docs. I didn't before because I wasn't sure about the name (as @:await now has a different meaning on either class/method/expr). But after this time I don't think I'm going to come up with something better :)
Oh, wait I spoke too soon. A method marked @:await does force its return type to Void
, but only once an @:await expression is used. I need a minute to check that restriction..
So, this works:
@:await function wrapper() {
@:async function local() {
return @:await something();
}
return whatever;
}
But, this doesn't:
@:await function wrapper() {
@:await something();
return whatever;
}
Because it cannot get transformed to something that makes sense.
Ok, then great. And the Void
case is very understandable. Thanks.
I would like to do this:
Note that wrapper is not tagged by
@:await
nor@:async