فهرست منبع

macros bugfix

Nicolas Cannasse 15 سال پیش
والد
کامیت
19059f0460
2فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 7 5
      typeload.ml
  2. 1 1
      typer.ml

+ 7 - 5
typeload.ml

@@ -746,11 +746,13 @@ let init_class ctx c p herits fields meta =
 					f_args = List.map (fun (a,o,t,e) -> a,o,(match t with None -> Some texpr | _ -> t),e) f.f_args;
 					f_expr = f.f_expr;
 				}
-			else {
-				f_type = None;
-				f_args = [];
-				f_expr = (EBlock [],p)
-			}
+			else 
+				let tdyn = Some (CTPath { tpackage = []; tname = "Dynamic"; tparams = []; tsub = None }) in
+				{
+					f_type = tdyn;
+					f_args = List.map (fun (a,o,_,_) -> a,o,tdyn,None) f.f_args;
+					f_expr = (EBlock [],p)
+				}
 			in
 			let parent = (if not stat then get_parent c name else None) in
 			let dynamic = List.mem ADynamic access || (match parent with Some { cf_kind = Method MethDynamic } -> true | _ -> false) in

+ 1 - 1
typer.ml

@@ -1841,7 +1841,7 @@ let type_macro ctx cpath f el p =
 	) in
 	let mctx = Interp.get_ctx() in
 	let m = (try Hashtbl.find ctx.g.types_module cpath with Not_found -> cpath) in
-	ignore(Typeload.load_module ctx2 m p);
+	ctx2.local_types <- (Typeload.load_module ctx2 m p).mtypes;
 	let meth = (match Typeload.load_instance ctx2 { tpackage = fst cpath; tname = snd cpath; tparams = []; tsub = None } p true with
 		| TInst (c,_) -> (try PMap.find f c.cl_statics with Not_found -> error ("Method " ^ f ^ " not found on class " ^ s_type_path cpath) p)
 		| _ -> error "Macro should be called on a class" p