@@ -106,7 +106,7 @@ let rec cleanup_delegate e = match e.eexpr with
106106 | _ -> e
107107
108108let funct gen t = match follow (run_follow gen t) with
109- | TFun (args ,ret ) -> args,ret
109+ | TFun (args ,ret , _ ) -> args,ret
110110 | _ -> raise Not_found
111111
112112let mk_conversion_fun gen e =
@@ -235,7 +235,7 @@ let traverse gen ?tparam_anon_decl ?tparam_anon_acc (handle_anon_func:texpr->tfu
235235 dynamic_func_call { e with eexpr = TCall (run e1, List. map run params) }
236236 | _ ->
237237 let i = ref 0 in
238- let t = TFun (List. map (fun e -> incr i; " arg" ^ (string_of_int ! i), false , e.etype) params, e.etype) in
238+ let t = TFun (List. map (fun e -> incr i; " arg" ^ (string_of_int ! i), false , e.etype) params, e.etype, false ) in
239239 dynamic_func_call { e with eexpr = TCall ( mk_castfast t (run e1), List. map run params ) }
240240 )
241241 (* | FNotFound ->
@@ -247,7 +247,7 @@ let traverse gen ?tparam_anon_decl ?tparam_anon_acc (handle_anon_func:texpr->tfu
247247 dynamic_func_call { e with eexpr = TCall (run e1, List. map run params) }
248248 | _ ->
249249 let i = ref 0 in
250- let t = TFun (List. map (fun e -> incr i; " arg" ^ (string_of_int ! i), false , e.etype) params, e.etype) in
250+ let t = TFun (List. map (fun e -> incr i; " arg" ^ (string_of_int ! i), false , e.etype) params, e.etype, false ) in
251251 dynamic_func_call { e with eexpr = TCall ( mk_castfast t (run e1), List. map run params ) }
252252 )
253253 | TFunction tf ->
@@ -264,7 +264,7 @@ let traverse gen ?tparam_anon_decl ?tparam_anon_acc (handle_anon_func:texpr->tfu
264264 let t = TFun (List. map (fun e ->
265265 incr i;
266266 (" p" ^ (string_of_int ! i), false , e.etype)
267- ) params, e.etype)
267+ ) params, e.etype, false )
268268 in
269269 fun e -> mk_castfast t e
270270 in
@@ -281,7 +281,7 @@ let rec get_type_params acc t =
281281 | TInst (( { cl_kind = KTypeParameter constraints } as cl ), [] ) ->
282282 let params = List. fold_left get_type_params acc constraints in
283283 List. filter (fun t -> not (List. memq t acc)) (cl :: params) @ acc;
284- | TFun (params ,tret ) ->
284+ | TFun (params ,tret , _ ) ->
285285 List. fold_left get_type_params acc ( tret :: List. map (fun (_ ,_ ,t ) -> t) params )
286286 | TDynamic t ->
287287 (match t with | TDynamic _ -> acc | _ -> get_type_params acc t)
@@ -325,7 +325,7 @@ let get_captured expr =
325325 | TFunction (tf ) ->
326326 List. iter (fun (v ,_ ) -> Hashtbl. add ignored v.v_id v) tf.tf_args;
327327 (match follow expr.etype with
328- | TFun (args ,ret ) ->
328+ | TFun (args ,ret , _ ) ->
329329 List. iter (fun (_ ,_ ,t ) ->
330330 check_params t
331331 ) args;
@@ -466,7 +466,7 @@ let configure gen ft =
466466 ifield,ifield,sa
467467 | Some _ ->
468468 let pos = cls.cl_pos in
469- let cf = mk_class_field " Delegate" (TFun (fun_args tfunc.tf_args, tfunc.tf_type)) true pos (Method MethNormal ) [] in
469+ let cf = mk_class_field " Delegate" (TFun (fun_args tfunc.tf_args, tfunc.tf_type, false )) true pos (Method MethNormal ) [] in
470470 cf.cf_expr < - Some { fexpr with eexpr = TFunction { tfunc with tf_expr = func_expr }; };
471471 add_class_field_flag cf CfFinal ;
472472 cls.cl_ordered_fields < - cf :: cls.cl_ordered_fields;
@@ -506,7 +506,7 @@ let configure gen ft =
506506 epos = pos;
507507 } in
508508
509- let ctor_type = (TFun (ctor_sig, gen.gcon.basic.tvoid)) in
509+ let ctor_type = (TFun (ctor_sig, gen.gcon.basic.tvoid, false )) in
510510 let ctor = mk_class_field " new" ctor_type true cls.cl_pos (Method (MethNormal )) [] in
511511 ctor.cf_expr < - Some (
512512 {
@@ -789,13 +789,13 @@ struct
789789 UPDATE: the fix will be that Int64 won't be a typedef to Float/Int
790790 *)
791791 let changed_sig, arity, type_number, changed_sig_ret, is_void, is_dynamic_func = match follow old_sig with
792- | TFun (_sig , ret ) ->
792+ | TFun (_sig , ret , coro ) ->
793793 let type_n, ret_t = rettype_real_to_func ret in
794794 let arity = List. length _sig in
795795 let is_dynamic_func = arity > = max_arity in
796796 let ret_t = if is_dynamic_func then t_dynamic else ret_t in
797797
798- (TFun (args_real_to_func_sig _sig, ret_t), arity, type_n, ret_t, ExtType. is_void ret, is_dynamic_func)
798+ (TFun (args_real_to_func_sig _sig, ret_t, coro ), arity, type_n, ret_t, ExtType. is_void ret, is_dynamic_func)
799799 | _ -> (print_endline (s_type (print_context() ) (follow old_sig) )); die " " __LOC__
800800 in
801801
@@ -868,12 +868,12 @@ struct
868868 let invoke_fun = if params_len > = max_arity then " invokeDynamic" else " invoke" ^ (string_of_int params_len) ^ postfix in
869869 let invoke_fun = mk_internal_name " hx" invoke_fun in
870870 let fun_t = match follow tc.etype with
871- | TFun (_sig , _ ) ->
872- TFun (args_real_to_func_sig _sig, ret_t)
871+ | TFun (_sig , _ , coro ) ->
872+ TFun (args_real_to_func_sig _sig, ret_t, coro )
873873 | _ ->
874874 let i = ref 0 in
875875 let _sig = List. map (fun p -> let name = " arg" ^ (string_of_int ! i) in incr i; (name,false ,p.etype) ) params in
876- TFun (args_real_to_func_sig _sig, ret_t)
876+ TFun (args_real_to_func_sig _sig, ret_t, false )
877877 in
878878
879879 let may_cast = match follow call_expr.etype with
@@ -904,7 +904,7 @@ struct
904904 let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
905905
906906 let mk_invoke_i i is_float =
907- let cf = mk_class_field (iname i is_float) (TFun (func_sig_i i, if is_float then basic.tfloat else t_dynamic)) false pos (Method MethNormal ) [] in
907+ let cf = mk_class_field (iname i is_float) (TFun (func_sig_i i, ( if is_float then basic.tfloat else t_dynamic), false )) false pos (Method MethNormal ) [] in
908908 cf
909909 in
910910
@@ -963,7 +963,7 @@ struct
963963
964964 let fn_expr = map_fn i ret (List. map fst args) api in
965965
966- let t = TFun (fun_args args, ret) in
966+ let t = TFun (fun_args args, ret, false ) in
967967
968968 let tfunction =
969969 {
@@ -1010,7 +1010,7 @@ struct
10101010 in
10111011
10121012 let args = [dynamic_arg, None ] in
1013- let dyn_t = TFun (fun_args args, t_dynamic) in
1013+ let dyn_t = TFun (fun_args args, t_dynamic, false ) in
10141014 let dyn_cf = mk_class_field (mk_internal_name " hx" " invokeDynamic" ) dyn_t false pos (Method MethNormal ) [] in
10151015
10161016 dyn_cf.cf_expr < - Some {
@@ -1024,7 +1024,7 @@ struct
10241024 };
10251025
10261026 let additional_cfs = begin
1027- let new_t = TFun ([" arity" , false , basic.tint; " type" , false , basic.tint],basic.tvoid) in
1027+ let new_t = TFun ([" arity" , false , basic.tint; " type" , false , basic.tint],basic.tvoid, false ) in
10281028 let new_cf = mk_class_field " new" (new_t) true pos (Method MethNormal ) [] in
10291029 let v_arity, v_type = alloc_var " arity" basic.tint, alloc_var " type" basic.tint in
10301030 let mk_assign v field = mk (TBinop (OpAssign , mk_this field v.v_type, mk_local v pos)) v.v_type pos in
@@ -1095,7 +1095,7 @@ struct
10951095 let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
10961096
10971097 let mk_invoke_switch i api =
1098- let t = TFun (func_sig_i i, t_dynamic) in
1098+ let t = TFun (func_sig_i i, t_dynamic, false ) in
10991099 (* case i: return this.invokeX_o(0, 0, 0, 0, 0, ... arg[0], args[1]....); *)
11001100 [make_int gen.gcon.basic i pos], mk_return (mk (TCall (mk_this (iname i false ) t, mk_dyn_call i api)) t_dynamic pos)
11011101 in
@@ -1109,7 +1109,7 @@ struct
11091109 let type_name = mk_internal_name " fn" " type" in
11101110 let mk_expr i is_float vars =
11111111 let call_expr =
1112- let call_t = TFun (List. map (fun v -> (v.v_name, false , v.v_type)) vars, if is_float then t_dynamic else basic.tfloat) in
1112+ let call_t = TFun (List. map (fun v -> (v.v_name, false , v.v_type)) vars, ( if is_float then t_dynamic else basic.tfloat), false ) in
11131113 {
11141114 eexpr = TCall (mk_this (iname i (not is_float)) call_t, List. map (fun v -> mk_local v pos) vars);
11151115 etype = if is_float then t_dynamic else basic.tfloat;
0 commit comments