فهرست منبع

sometimes use `macro` as platform name

closes #7488
Simon Krajewski 7 سال پیش
والد
کامیت
2ef96a9a14
5فایلهای تغییر یافته به همراه12 افزوده شده و 6 حذف شده
  1. 2 2
      src/codegen/codegen.ml
  2. 4 1
      src/compiler/main.ml
  3. 4 1
      src/context/common.ml
  4. 1 1
      src/optimization/analyzer.ml
  5. 1 1
      src/typing/typeloadParse.ml

+ 2 - 2
src/codegen/codegen.ml

@@ -275,7 +275,7 @@ module Dump = struct
 			close_out ch)
 
 	let create_dumpfile_from_path com path =
-		let buf,close = create_dumpfile [] ("dump" :: (platform_name com.platform) :: fst path @ [snd path]) in
+		let buf,close = create_dumpfile [] ("dump" :: (platform_name_macro com) :: fst path @ [snd path]) in
 		buf,close
 
 	let dump_types com s_expr =
@@ -396,7 +396,7 @@ module Dump = struct
 
 	let dump_dependencies ?(target_override=None) com =
 		let target_name = match target_override with
-			| None -> platform_name com.platform
+			| None -> platform_name_macro com
 			| Some s -> s
 		in
 		let buf,close = create_dumpfile [] ["dump";target_name;".dependencies"] in

+ 4 - 1
src/compiler/main.ml

@@ -277,7 +277,10 @@ let generate tctx ext xml_out interp swf_header =
 		to accidentaly delete a source file. *)
 	if file_extension com.file = ext then delete_file com.file;
 	if com.platform = Flash || com.platform = Cpp || com.platform = Hl then List.iter (Codegen.fix_overrides com) com.types;
-	if Common.defined com Define.Dump then Codegen.Dump.dump_types com;
+	if Common.defined com Define.Dump then begin
+		Codegen.Dump.dump_types com;
+		Option.may Codegen.Dump.dump_types (com.get_macros())
+	end;
 	if Common.defined com Define.DumpDependencies then begin
 		Codegen.Dump.dump_dependencies com;
 		if not tctx.Typecore.in_macro then match tctx.Typecore.g.Typecore.macros with

+ 4 - 1
src/context/common.ml

@@ -552,6 +552,9 @@ let add_filter ctx f =
 let add_final_filter ctx f =
 	ctx.callbacks.after_generation <- f :: ctx.callbacks.after_generation
 
+let platform_name_macro com =
+	if defined com Define.Macro then "macro" else platform_name com.platform
+
 let find_file ctx f =
 	try
 		(match Hashtbl.find ctx.file_lookup_cache f with
@@ -568,7 +571,7 @@ let find_file ctx f =
 				if Sys.file_exists file then begin
 					(try
 						let ext = String.rindex file '.' in
-						let file_pf = String.sub file 0 (ext + 1) ^ platform_name ctx.platform ^ String.sub file ext (String.length file - ext) in
+						let file_pf = String.sub file 0 (ext + 1) ^ platform_name_macro ctx ^ String.sub file ext (String.length file - ext) in
 						if not (defined ctx Define.CoreApi) && Sys.file_exists file_pf then file_pf else file
 					with Not_found ->
 						file)

+ 1 - 1
src/optimization/analyzer.ml

@@ -807,7 +807,7 @@ module Debug = struct
 		) g.g_var_infos
 
 	let get_dump_path ctx c cf =
-		"dump" :: [platform_name ctx.com.platform] @ (fst c.cl_path) @ [Printf.sprintf "%s.%s" (snd c.cl_path) cf.cf_name]
+		"dump" :: [platform_name_macro ctx.com] @ (fst c.cl_path) @ [Printf.sprintf "%s.%s" (snd c.cl_path) cf.cf_name]
 
 	let dot_debug ctx c cf =
 		let g = ctx.graph in

+ 1 - 1
src/typing/typeloadParse.ml

@@ -123,7 +123,7 @@ let resolve_module_file com m remap p =
 		let meta = loop decls in
 		if not (Meta.has Meta.NoPackageRestrict meta) then begin
 			let x = (match fst m with [] -> assert false | x :: _ -> x) in
-			raise (Forbid_package ((x,m,p),[],if Common.defined com Define.Macro then "macro" else platform_name com.platform));
+			raise (Forbid_package ((x,m,p),[],platform_name_macro com));
 		end;
 	end;
 	file