Bläddra i källkod

don't regenerate when the compilation was fully cached

Nicolas Cannasse 6 år sedan
förälder
incheckning
f0be760d86
4 ändrade filer med 9 tillägg och 0 borttagningar
  1. 5 0
      src/compiler/main.ml
  2. 1 0
      src/compiler/server.ml
  3. 2 0
      src/context/common.ml
  4. 1 0
      src/typing/typeloadParse.ml

+ 5 - 0
src/compiler/main.ml

@@ -947,6 +947,11 @@ try
 		Filters.run com tctx main;
 		Filters.run com tctx main;
 		t();
 		t();
 		if ctx.has_error then raise Abort;
 		if ctx.has_error then raise Abort;
+		if not com.needs_generation then begin
+			xml_out := None;
+			json_out := None;
+			no_output := true;
+		end;
 		begin match !xml_out with
 		begin match !xml_out with
 			| None -> ()
 			| None -> ()
 			| Some "hx" ->
 			| Some "hx" ->

+ 1 - 0
src/compiler/server.ml

@@ -425,6 +425,7 @@ let rec wait_loop process_params verbose accept =
 		in
 		in
 		let create params =
 		let create params =
 			let ctx = create_context params in
 			let ctx = create_context params in
+			ctx.com.needs_generation <- false;
 			ctx.flush <- (fun() ->
 			ctx.flush <- (fun() ->
 				incr compilation_step;
 				incr compilation_step;
 				compilation_mark := !mark_loop;
 				compilation_mark := !mark_loop;

+ 2 - 0
src/context/common.ml

@@ -190,6 +190,7 @@ type context = {
 	mutable stored_typed_exprs : (int, texpr) PMap.t;
 	mutable stored_typed_exprs : (int, texpr) PMap.t;
 	pass_debug_messages : string DynArray.t;
 	pass_debug_messages : string DynArray.t;
 	(* output *)
 	(* output *)
+	mutable needs_generation : bool;
 	mutable file : string;
 	mutable file : string;
 	mutable flash_version : float;
 	mutable flash_version : float;
 	mutable features : (string,bool) Hashtbl.t;
 	mutable features : (string,bool) Hashtbl.t;
@@ -405,6 +406,7 @@ let create version s_version args =
 			unresolved_identifiers = [];
 			unresolved_identifiers = [];
 			interface_field_implementations = [];
 			interface_field_implementations = [];
 		};
 		};
+		needs_generation = true;
 		sys_args = args;
 		sys_args = args;
 		debug = false;
 		debug = false;
 		display = DisplayTypes.DisplayMode.create !Parser.display_mode;
 		display = DisplayTypes.DisplayMode.create !Parser.display_mode;

+ 1 - 0
src/typing/typeloadParse.ml

@@ -30,6 +30,7 @@ open Error
 let parse_file_from_lexbuf com file p lexbuf =
 let parse_file_from_lexbuf com file p lexbuf =
 	let t = Timer.timer ["parsing"] in
 	let t = Timer.timer ["parsing"] in
 	Lexer.init file true;
 	Lexer.init file true;
+	com.needs_generation <- true;
 	incr stats.s_files_parsed;
 	incr stats.s_files_parsed;
 	let parse_result = try
 	let parse_result = try
 		ParserEntry.parse com.defines lexbuf file
 		ParserEntry.parse com.defines lexbuf file