|
@@ -181,8 +181,17 @@ abstract Coroutine<T:haxe.Constraints.Function> {
|
|
|
for resuming coroutine execution.
|
|
|
**/
|
|
|
@:coroutine
|
|
|
+ #if jvm overload #end
|
|
|
public static extern function suspend<T>(f:(cont:(T, Null<Dynamic>) -> Void)->Void):T;
|
|
|
|
|
|
+ #if jvm
|
|
|
+ @:native("suspend")
|
|
|
+ @:ifFeature("_StdTypes.Coroutine_Impl_.suspend")
|
|
|
+ static function nativeSuspend<T>(f, cont:(T, Null<Dynamic>) -> Void) {
|
|
|
+ return (_, _) -> f(cont);
|
|
|
+ }
|
|
|
+ #end
|
|
|
+
|
|
|
#if js // TODO: implement this all properly for all the targets
|
|
|
static function __init__():Void {
|
|
|
js.Syntax.code("{0} = {1}", Coroutine.suspend, cast function(f, cont) return (_, _) -> f(cont));
|