2
0
Эх сурвалжийг харах

bugfix in macros captured vars

Nicolas Cannasse 14 жил өмнө
parent
commit
6ba8b920d2
3 өөрчлөгдсөн 4 нэмэгдсэн , 3 устгасан
  1. 2 2
      codegen.ml
  2. 1 0
      interp.ml
  3. 1 1
      main.ml

+ 2 - 2
codegen.ml

@@ -862,7 +862,7 @@ let check_local_vars_init e =
 (* -------------------------------------------------------------------------- *)
 (* POST PROCESS *)
 
-let post_process ctx filters =
+let post_process types filters =
 	List.iter (fun t ->
 		match t with
 		| TClassDecl c ->
@@ -883,7 +883,7 @@ let post_process ctx filters =
 				c.cl_init <- Some (List.fold_left (fun e f -> f e) e filters));
 		| TEnumDecl _ -> ()
 		| TTypeDecl _ -> ()
-	) ctx.types
+	) types
 
 (* -------------------------------------------------------------------------- *)
 (* STACK MANAGEMENT EMULATION *)

+ 1 - 0
interp.ml

@@ -2685,6 +2685,7 @@ let add_types ctx types =
 			true;
 		end
 	) types in
+	Codegen.post_process types [Codegen.captured_vars ctx.com];
 	let e = (EBlock (Genneko.build ctx.gen types), null_pos) in
 	ignore(catch_errors ctx (fun() -> ignore((eval ctx e)())))
 

+ 1 - 1
main.ml

@@ -611,7 +611,7 @@ try
 			Codegen.captured_vars com;
 			Codegen.rename_local_vars com;
 		] in
-		Codegen.post_process com filters;
+		Codegen.post_process com.types filters;
 		Common.add_filter com (fun() -> List.iter (Codegen.on_generate ctx) com.types);
 		List.iter (fun f -> f()) (List.rev com.filters);
 		(match !xml_out with