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

allow -D noopt to turn off optimizer

Nicolas Cannasse 16 жил өмнө
parent
commit
4b49fbfdbf
3 өөрчлөгдсөн 7 нэмэгдсэн , 2 устгасан
  1. 2 0
      common.ml
  2. 4 1
      main.ml
  3. 1 1
      optimizer.ml

+ 2 - 0
common.ml

@@ -56,6 +56,7 @@ type context = {
 	version : int;
 	mutable debug : bool;
 	mutable verbose : bool;
+	mutable foptimize : bool;
 	mutable platform : platform;
 	mutable class_path : string list;
 	mutable main_class : Type.path option; 
@@ -82,6 +83,7 @@ let create v =
 		version = v;
 		debug = false;
 		verbose = false;
+		foptimize = true;
 		platform = Cross;
 		class_path = [];
 		main_class = None;

+ 4 - 1
main.ml

@@ -294,7 +294,10 @@ try
 			Common.define com l;
 		),"<library[:version]> : use an haxelib library");
 		("-D",Arg.String (fun var ->
-			if var = "use_rtti_doc" then Parser.use_doc := true;
+			(match var with
+			| "use_rtti_doc" -> Parser.use_doc := true
+			| "noopt" -> com.foptimize <- false
+			| _ -> ());
 			Common.define com var
 		),"<var> : define a conditional compilation flag");
 		("-v",Arg.Unit (fun () ->

+ 1 - 1
optimizer.ml

@@ -433,4 +433,4 @@ let rec reduce_loop com is_sub e =
 		e
 
 let reduce_expression com e =
-	reduce_loop com false e
+	if com.foptimize then reduce_loop com false e else e