Browse Source

remove --eval command line argument

Simon Krajewski 8 years ago
parent
commit
12b227909c
3 changed files with 1 additions and 34 deletions
  1. 1 0
      extra/CHANGES.txt
  2. 0 6
      src/compiler/main.ml
  3. 0 28
      src/typing/typer.ml

+ 1 - 0
extra/CHANGES.txt

@@ -11,6 +11,7 @@
 
 	Removals:
 
+	all : removed --eval command line argument
 	sys : SPOD (sys.db.Object, sys.db.Manager and friends) was moved into a separate library `record-macros` (https://github.com/HaxeFoundation/record-macros)
 	js : js.JQuery and js.SWFObject were moved into hx3compat library (https://github.com/HaxeFoundation/hx3compat),
 	     it's recommended to use more modern js.jquery.JQuery and js.swfobject.SWFObject classes.

+ 0 - 6
src/compiler/main.ml

@@ -450,7 +450,6 @@ try
 	let pre_compilation = ref [] in
 	let interp = ref false in
 	let swf_version = ref false in
-	let evals = ref [] in
 	Common.define_value com Define.HaxeVer (Printf.sprintf "%.3f" (float_of_int Globals.version /. 1000.));
 	Common.raw_define com "haxe3";
 	Common.define_value com Define.Dce "std";
@@ -681,10 +680,6 @@ try
 			force_typing := true;
 			config_macros := e :: !config_macros
 		)," : call the given macro before typing anything else");
-		("--eval", Arg.String (fun s ->
-			force_typing := true;
-			evals := s :: !evals;
-		), " : evaluates argument as Haxe module code");
 		("--wait", Arg.String (fun hp ->
 			let accept = match hp with
 				| "stdio" ->
@@ -788,7 +783,6 @@ try
 		Typecore.type_expr_ref := (fun ctx e with_type -> Typer.type_expr ctx e with_type);
 		let tctx = Typer.create com in
 		List.iter (MacroContext.call_init_macro tctx) (List.rev !config_macros);
-		List.iter (Typer.eval tctx) !evals;
 		List.iter (fun cpath -> ignore(tctx.Typecore.g.Typecore.do_load_module tctx cpath null_pos)) (List.rev !classes);
 		Typer.finalize tctx;
 		t();

+ 0 - 28
src/typing/typer.ml

@@ -333,34 +333,6 @@ let prepare_using_field cf = match follow cf.cf_type with
 		{cf with cf_overloads = loop [] cf.cf_overloads; cf_type = TFun(args,ret)}
 	| _ -> cf
 
-let eval ctx s =
-	let p = { pfile = "--eval"; pmin = 0; pmax = String.length s; } in
-	let pack,decls = Parser.parse_string ctx.com s p error false in
-	let rec find_main current decls = match decls with
-		| (EClass c,_) :: decls ->
-			let path = pack,fst c.d_name in
-			begin try
-				let cff = List.find (fun cff -> fst cff.cff_name = "main") c.d_data in
-				if ctx.com.main_class <> None then error "Multiple main" cff.cff_pos;
-				ctx.com.main_class <- Some path;
-				Some path
-			with Not_found ->
-				find_main (if current = None then Some path else current) decls
-			end
-		| ((EEnum {d_name = (s,_)} | ETypedef {d_name = (s,_)} | EAbstract {d_name = (s,_)}),_) :: decls when current = None ->
-			find_main (Some (pack,s)) decls
-		| _ :: decls ->
-			find_main current decls
-		| [] ->
-			current
-	in
-	let path_module = match find_main None decls with
-		| None -> error "Evaluated string did not define any types" p
-		| Some path -> path
-	in
-	ignore(Typeload.type_module ctx path_module "eval" decls p);
-	flush_pass ctx PBuildClass "eval"
-
 let merge_core_doc ctx c =
 	let c_core = Typeload.load_core_class ctx c in
 	if c.cl_doc = None then c.cl_doc <- c_core.cl_doc;