فهرست منبع

fix inference insanity

see #4
Simon Krajewski 5 ماه پیش
والد
کامیت
d4431e49c4
2فایلهای تغییر یافته به همراه5 افزوده شده و 7 حذف شده
  1. 5 5
      std/haxe/coro/Coroutine.hx
  2. 0 2
      tests/misc/coroutines/src/Main.hx

+ 5 - 5
std/haxe/coro/Coroutine.hx

@@ -11,7 +11,7 @@ import haxe.coro.continuations.BlockingContinuation;
 @:callable
 @:coreType
 abstract Coroutine<T:haxe.Constraints.Function> {
-	@:coroutine public static function suspend<T>(func:(IContinuation<Any>)->Void):T {
+	@:coroutine public static function suspend<T>(func:(IContinuation<Any>) -> Void):T {
 		final cont = haxe.coro.Intrinsics.currentContinuation();
 		final safe = new RacingContinuation(cont);
 
@@ -21,7 +21,7 @@ abstract Coroutine<T:haxe.Constraints.Function> {
 		return cast safe.getOrThrow();
 	}
 
-    @:coroutine public static function delay(ms:Int):Void {
+	@:coroutine public static function delay(ms:Int):Void {
 		Coroutine.suspend(cont -> {
 			cont._hx_context.scheduler.scheduleIn(() -> cont.resume(null, null), ms);
 		});
@@ -33,9 +33,9 @@ abstract Coroutine<T:haxe.Constraints.Function> {
 		});
 	}
 
-	public static function run<T>(f:Coroutine<()->T>) {
-		final loop   = new EventLoop();
-		final cont   = new BlockingContinuation(loop, new EventLoopScheduler(loop));
+	public static function run<T>(f:Coroutine<() -> T>):T {
+		final loop = new EventLoop();
+		final cont = new BlockingContinuation(loop, new EventLoopScheduler(loop));
 		final result = f(cont);
 
 		return if (result is Primitive) {

+ 0 - 2
tests/misc/coroutines/src/Main.hx

@@ -5,9 +5,7 @@ function main() {
 		new TestBasic(),
 		new TestTricky(),
 		new TestControlFlow(),
-		#if !jvm
 		new TestHoisting(),
-		#end
 		new TestMisc()
 		// new TestGenerator(),
 		// #if js