|
@@ -54,6 +54,7 @@ type object_store = {
|
|
mutable os_fields : object_store list;
|
|
mutable os_fields : object_store list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
let debug_expression expression =
|
|
let debug_expression expression =
|
|
" --[[ " ^ Type.s_expr_kind expression ^ " --]] "
|
|
" --[[ " ^ Type.s_expr_kind expression ^ " --]] "
|
|
|
|
|
|
@@ -2001,15 +2002,18 @@ let generate com =
|
|
println ctx "_hx_array_mt.__index = Array.prototype";
|
|
println ctx "_hx_array_mt.__index = Array.prototype";
|
|
newline ctx;
|
|
newline ctx;
|
|
|
|
|
|
|
|
+ let b = open_block ctx in
|
|
|
|
+ println ctx "local _hx_static_init = function()";
|
|
(* Generate statics *)
|
|
(* Generate statics *)
|
|
List.iter (generate_static ctx) (List.rev ctx.statics);
|
|
List.iter (generate_static ctx) (List.rev ctx.statics);
|
|
-
|
|
|
|
(* Localize init variables inside a do-block *)
|
|
(* Localize init variables inside a do-block *)
|
|
(* Note: __init__ logic can modify static variables. *)
|
|
(* Note: __init__ logic can modify static variables. *)
|
|
- println ctx "do";
|
|
|
|
|
|
+ (* Generate statics *)
|
|
List.iter (gen_block_element ctx) (List.rev ctx.inits);
|
|
List.iter (gen_block_element ctx) (List.rev ctx.inits);
|
|
|
|
+ b();
|
|
newline ctx;
|
|
newline ctx;
|
|
println ctx "end";
|
|
println ctx "end";
|
|
|
|
+ newline ctx;
|
|
|
|
|
|
let rec chk_features e =
|
|
let rec chk_features e =
|
|
if is_dynamic_iterator ctx e then add_feature ctx "use._iterator";
|
|
if is_dynamic_iterator ctx e then add_feature ctx "use._iterator";
|
|
@@ -2111,6 +2115,8 @@ let generate com =
|
|
println ctx "end;";
|
|
println ctx "end;";
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ println ctx "_hx_static_init();";
|
|
|
|
+
|
|
List.iter (generate_enumMeta_fields ctx) com.types;
|
|
List.iter (generate_enumMeta_fields ctx) com.types;
|
|
|
|
|
|
(match com.main with
|
|
(match com.main with
|