|
@@ -3410,10 +3410,11 @@ let generate_static_init ctx types main =
|
|
|
) types;
|
|
|
in
|
|
|
(* init class statics *)
|
|
|
+ let init_exprs = ref [] in
|
|
|
List.iter (fun t ->
|
|
|
+ (match t with TClassDecl { cl_init = Some e } -> init_exprs := e :: !init_exprs | _ -> ());
|
|
|
match t with
|
|
|
| TClassDecl c when not c.cl_extern ->
|
|
|
- (match c.cl_init with None -> () | Some e -> exprs := e :: !exprs);
|
|
|
List.iter (fun f ->
|
|
|
match f.cf_kind, f.cf_expr with
|
|
|
| Var _, Some e ->
|
|
@@ -3430,7 +3431,8 @@ let generate_static_init ctx types main =
|
|
|
| None -> ()
|
|
|
| Some e -> exprs := e :: !exprs);
|
|
|
let fid = lookup_alloc ctx.cfids () in
|
|
|
- ignore(make_fun ~gen_content ctx ("","") fid { tf_expr = mk (TBlock (List.rev !exprs)) t_void null_pos; tf_args = []; tf_type = t_void } None None);
|
|
|
+ let exprs = List.rev !init_exprs @ List.rev !exprs in
|
|
|
+ ignore(make_fun ~gen_content ctx ("","") fid { tf_expr = mk (TBlock exprs) t_void null_pos; tf_args = []; tf_type = t_void } None None);
|
|
|
fid
|
|
|
|
|
|
(* --------------------------------------------------------------------------------------------------------------------- *)
|