瀏覽代碼

Make hl works for tests

Yuxiao Mao 1 年之前
父節點
當前提交
78a7cedc52
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 1 1
      std/haxe/coro/Coroutine.hx
  2. 9 0
      tests/misc/coroutines/src/TestGenerator.hx

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

@@ -16,7 +16,7 @@ abstract Coroutine<T:haxe.Constraints.Function> {
 	#end
 	public static extern function suspend<T>(f:(cont:Continuation<T, Null<Dynamic>>)->Void):T;
 
-	#if (jvm || eval)
+	#if (jvm || eval || hl)
 	@:native("suspend")
 	@:keep
 	static function nativeSuspend<T>(f, cont:Continuation<T, Null<Dynamic>>) {

+ 9 - 0
tests/misc/coroutines/src/TestGenerator.hx

@@ -38,8 +38,17 @@ class TestGenerator extends utest.Test {
 	}
 }
 
+#if hl
+// hl has some problem when dealing with recursive anon, use a class to bypass
+@:structInit class Tree<T> {
+	public var leaf:T;
+	@:optional public var left:Tree<T>;
+	@:optional public var right:Tree<T>;
+}
+#else
 private typedef Tree<T> = {
 	var leaf:T;
 	var ?left:Tree<T>;
 	var ?right:Tree<T>;
 }
+#end