浏览代码

fix static init order

frabbit 11 年之前
父节点
当前提交
5d873395de
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      genpy.ml

+ 2 - 2
genpy.ml

@@ -1566,7 +1566,7 @@ module Generator = struct
 		let f = fun () ->
 		let f = fun () ->
 			List.iter (fun cf -> gen_static_field ctx c p cf) c.cl_ordered_statics;
 			List.iter (fun cf -> gen_static_field ctx c p cf) c.cl_ordered_statics;
 		in
 		in
-		ctx.static_inits <- f :: ctx.static_inits
+		ctx.static_inits <- ctx.static_inits @ [f]
 
 
 	let gen_class_init ctx c =
 	let gen_class_init ctx c =
 		match c.cl_init with
 		match c.cl_init with
@@ -1577,7 +1577,7 @@ module Generator = struct
 					let e = transform_expr e in
 					let e = transform_expr e in
 					spr_line ctx (texpr_str e (Printer.create_context ""));
 					spr_line ctx (texpr_str e (Printer.create_context ""));
 				in
 				in
-				ctx.static_inits <- f :: ctx.static_inits
+				ctx.static_inits <- ctx.static_inits @ [f]
 
 
 	let gen_class ctx c =
 	let gen_class ctx c =
 		gen_pre_code_meta ctx c.cl_meta;
 		gen_pre_code_meta ctx c.cl_meta;