Ver Fonte

move doinline to com

Simon Krajewski há 5 meses atrás
pai
commit
d5ff609636

+ 1 - 0
src/compiler/compiler.ml

@@ -503,6 +503,7 @@ let catch_completion_and_exit ctx callbacks run =
 			i
 
 let process_actx ctx actx =
+	ctx.com.doinline <- ctx.com.display.dms_inline && not (Common.defined ctx.com Define.NoInline);
 	ctx.timer_ctx.measure_times <- (if actx.measure_times then Yes else No);
 	DisplayProcessing.process_display_arg ctx actx;
 	List.iter (fun s ->

+ 2 - 0
src/context/common.ml

@@ -242,6 +242,7 @@ type context = {
 	mutable debug : bool;
 	mutable verbose : bool;
 	mutable foptimize : bool;
+	mutable doinline : bool;
 	mutable platform : platform;
 	mutable config : PlatformConfig.platform_config;
 	empty_class_path : ClassPath.class_path;
@@ -697,6 +698,7 @@ let create timer_ctx compilation_step cs version args display_mode =
 		display = display_mode;
 		verbose = false;
 		foptimize = true;
+		doinline = true;
 		features = Hashtbl.create 0;
 		platform = Cross;
 		config = default_config;

+ 1 - 2
src/context/typecore.ml

@@ -94,7 +94,6 @@ type typer_globals = {
 	mutable delayed : typer_pass_tasks Array.t;
 	mutable delayed_min_index : int;
 	mutable debug_delayed : (typer_pass * ((unit -> unit) * (string * string list) * typer) list) list;
-	doinline : bool;
 	retain_meta : bool;
 	mutable core_api : typer option;
 	mutable macros : ((unit -> unit) * typer) option;
@@ -508,7 +507,7 @@ let is_forced_inline c cf =
 	| _ -> false
 
 let needs_inline ctx c cf =
-	cf.cf_kind = Method MethInline && ctx.allow_inline && (ctx.g.doinline || is_forced_inline c cf)
+	cf.cf_kind = Method MethInline && ctx.allow_inline && (ctx.com.doinline || is_forced_inline c cf)
 
 (** checks if we can access to a given class field using current context *)
 let can_access ctx c cf stat =

+ 1 - 1
src/typing/callUnification.ml

@@ -132,7 +132,7 @@ let unify_call_args ctx el args r callp inline force_inline in_overload =
 				ignore(loop [] args);
 				[]
 			end else begin match loop [] args with
-				| [] when not (inline && (ctx.g.doinline || force_inline)) && not ctx.com.config.pf_pad_nulls ->
+				| [] when not (inline && (ctx.com.doinline || force_inline)) && not ctx.com.config.pf_pad_nulls ->
 					if is_pos_infos t then [mk_pos_infos t]
 					else []
 				| args ->

+ 1 - 1
src/typing/fields.ml

@@ -126,7 +126,7 @@ let field_access ctx mode f fh e pfield =
 		in
 		let default () =
 			match m, mode with
-			| MethInline, _ when ctx.g.doinline && ctx.allow_inline ->
+			| MethInline, _ when ctx.com.doinline && ctx.allow_inline ->
 				AKField (make_access true)
 			| MethMacro, MGet ->
 				display_error ctx.com "Macro functions must be called immediately" pfield; normal()

+ 1 - 1
src/typing/typeloadFields.ml

@@ -793,7 +793,7 @@ module TypeBinding = struct
 						e
 					end in
 					e
-				| Var v when v.v_read = AccInline && (ctx.g.doinline || is_forced_inline (Some c) cf) ->
+				| Var v when v.v_read = AccInline && (ctx.com.doinline || is_forced_inline (Some c) cf) ->
 					let e = require_constant_expression e "Inline variable initialization must be a constant value" in
 					begin match c.cl_kind with
 						| KAbstractImpl a when has_class_field_flag cf CfEnum && a.a_enum ->

+ 0 - 1
src/typing/typerEntry.ml

@@ -17,7 +17,6 @@ let create com macros =
 			delayed = Array.init TyperPass.all_typer_passes_length (fun _ -> { tasks = []});
 			delayed_min_index = 0;
 			debug_delayed = [];
-			doinline = com.display.dms_inline && not (Common.defined com Define.NoInline);
 			retain_meta = Common.defined com Define.RetainUntypedMeta;
 			std_types = null_module;
 			global_using = [];