Browse Source

add build-hl.hxml

Doesn't work yet though
Simon Krajewski 1 year ago
parent
commit
b0796e1136
2 changed files with 13 additions and 0 deletions
  1. 10 0
      src/generators/genhl.ml
  2. 3 0
      tests/misc/coroutines/build-hl.hxml

+ 10 - 0
src/generators/genhl.ml

@@ -472,6 +472,16 @@ let rec to_type ?tref ctx t =
 			| ["hl"], "I64" -> HI64
 			| ["hl"], "I64" -> HI64
 			| ["hl"], "NativeArray" -> HArray
 			| ["hl"], "NativeArray" -> HArray
 			| ["haxe";"macro"], "Position" -> HAbstract ("macro_pos", alloc_string ctx "macro_pos")
 			| ["haxe";"macro"], "Position" -> HAbstract ("macro_pos", alloc_string ctx "macro_pos")
+			| ["haxe";"coro"], "Coroutine" ->
+				begin match pl with
+				| [TFun(args,ret)] ->
+					let tcontinuation = tfun [ret; t_dynamic] ctx.com.basic.tvoid in
+					let args = args @ [("",false,tcontinuation)] in
+					let ret = tfun [t_dynamic; t_dynamic] ctx.com.basic.tvoid in
+					to_type ctx (TFun(args,ret))
+				| _ ->
+					die "" __LOC__
+				end
 			| _ -> failwith ("Unknown core type " ^ s_type_path a.a_path))
 			| _ -> failwith ("Unknown core type " ^ s_type_path a.a_path))
 		else
 		else
 			get_rec_cache ctx t
 			get_rec_cache ctx t

+ 3 - 0
tests/misc/coroutines/build-hl.hxml

@@ -0,0 +1,3 @@
+build-base.hxml
+--hl test.hl
+--cmd hl test.hl