Răsfoiți Sursa

enabled trailing whitespace removal

Simon Krajewski 12 ani în urmă
părinte
comite
3f37d3b7cd
18 a modificat fișierele cu 255 adăugiri și 255 ștergeri
  1. 1 1
      codegen.ml
  2. 3 3
      common.ml
  3. 6 6
      dce.ml
  4. 4 4
      genas3.ml
  5. 186 186
      gencommon.ml
  6. 1 1
      gencpp.ml
  7. 3 3
      gencs.ml
  8. 2 2
      genjava.ml
  9. 22 22
      genphp.ml
  10. 1 1
      genswf8.ml
  11. 1 1
      genswf9.ml
  12. 4 4
      genxml.ml
  13. 2 2
      interp.ml
  14. 1 1
      lexer.mll
  15. 2 2
      main.ml
  16. 14 14
      matcher.ml
  17. 1 1
      parser.ml
  18. 1 1
      typer.ml

+ 1 - 1
codegen.ml

@@ -587,7 +587,7 @@ let save_class_state ctx t = match t with
 	| _ ->
 		()
 
-		
+
 (* Checks if a private class' path clashes with another path *)
 let check_private_path ctx t = match t with
 	| TClassDecl c when c.cl_private ->

+ 3 - 3
common.ml

@@ -137,7 +137,7 @@ let display_default = ref false
 module Define = struct
 
 	type strict_defined =
-		| AbsolutePath	
+		| AbsolutePath
 		| AdvancedTelemetry
 		| As3
 		| CheckXmlProxy
@@ -215,7 +215,7 @@ module Define = struct
 		| HaxeVer -> ("haxe_ver","The current Haxe version value")
 		| Interp -> ("interp","The code is compiled to be run with --interp")
 		| JsClassic -> ("js_classic","Don't use a function wrapper and strict mode in JS output")
-		| JsModern -> ("js_modern","Use function wrapper and strict mode in JS output")		
+		| JsModern -> ("js_modern","Use function wrapper and strict mode in JS output")
 		| Macro -> ("macro","Defined when we compile code in the macro context")
 		| MacroTimes -> ("macro_times","Display per-macro timing when used with --times")
 		| MatchDebug -> ("match_debug","Show Pattern Matcher log")
@@ -516,7 +516,7 @@ let raw_define ctx v =
 
 let define_value ctx k v =
 	raw_define ctx (fst (Define.infos k) ^ "=" ^ v)
-	
+
 let define ctx v =
 	raw_define ctx (fst (Define.infos v))
 

+ 6 - 6
dce.ml

@@ -27,7 +27,7 @@
  *  - cpp target does not like removing unused overridden fields
  *  - most targets seem to require keeping a property field even if it is used only through its accessor methods
  *  - I did not consider inlining at all because I'm pretty sure I don't have to at this compilation stage
- * 
+ *
  *)
 
 open Ast
@@ -191,7 +191,7 @@ let rec field dce c n stat =
 			in
 			(match prefix,cf.cf_kind with
 				| "get_",Var {v_read = AccCall s} when s = n -> keep()
-				| "set_",Var {v_write = AccCall s} when s = n -> keep()	
+				| "set_",Var {v_write = AccCall s} when s = n -> keep()
 				| _ -> raise Not_found
 			);
 		end;
@@ -336,7 +336,7 @@ let run com main full =
 				| _ -> assert false)
 			| _ -> assert false)
 		| _ -> loop [] com.types
-	in	
+	in
 	if dce.debug then begin
 		List.iter (fun (c,cf,_) -> match cf.cf_expr with
 			| None -> ()
@@ -346,12 +346,12 @@ let run com main full =
 
 	(* second step: initiate DCE passes and keep going until no new fields were added *)
 	let rec loop cfl =
-		(* extend to dependent (= overriding/implementing) class fields *)	
+		(* extend to dependent (= overriding/implementing) class fields *)
 		List.iter (fun (c,cf,stat) -> mark_dependent_fields dce c cf.cf_name stat) cfl;
 		(* mark fields as used *)
 		List.iter (fun (c,cf,stat) -> mark_field dce c cf stat; mark_t dce cf.cf_type) cfl;
 		(* follow expressions to new types/fields *)
-		List.iter (fun (_,cf,_) -> opt (expr dce) cf.cf_expr) cfl;		
+		List.iter (fun (_,cf,_) -> opt (expr dce) cf.cf_expr) cfl;
 		match dce.added_fields with
 		| [] -> ()
 		| cfl ->
@@ -419,7 +419,7 @@ let run com main full =
 				| Var {v_write = AccCall s; v_read = a} ->
 					cf.cf_kind <- Var {v_write = if has_accessor c s stat then AccCall s else AccNever; v_read = a}
 				| _ -> ())
-			in		
+			in
 			List.iter (check_prop true) c.cl_ordered_statics;
 			List.iter (check_prop false) c.cl_ordered_fields;
 		| _ -> ()

+ 4 - 4
genas3.ml

@@ -352,7 +352,7 @@ let gen_function_header ctx name f params p =
 	let old_bi = ctx.block_inits in
 	ctx.in_value <- None;
 	ctx.local_types <- List.map snd params @ ctx.local_types;
-	let init () = 
+	let init () =
  		List.iter (fun (v,o) -> match o with
 			| Some c when is_nullable v.v_type && c <> TNull ->
 				newline ctx;
@@ -488,7 +488,7 @@ let rec gen_call ctx e el r =
 		spr ctx ")";
 		spr ctx "(";
 		concat ctx "," (gen_value ctx) el;
-		spr ctx ")"	
+		spr ctx ")"
 	| _ ->
 		gen_value ctx e;
 		spr ctx "(";
@@ -573,7 +573,7 @@ and gen_expr ctx e =
 		spr ctx "(";
 		gen_value ctx e;
 		print ctx "[\"%s\"]" s;
-		print ctx " as %s)" (type_str ctx e.etype e.epos);		
+		print ctx " as %s)" (type_str ctx e.etype e.epos);
 	| TField (e,s) | TClosure (e,s) ->
    		gen_value ctx e;
 		gen_field_access ctx e.etype s
@@ -597,7 +597,7 @@ and gen_expr ctx e =
 			spr ctx "return";
 			bend();
 			newline ctx;
-			print ctx "}";			
+			print ctx "}";
 		| Some e ->
 			spr ctx "return ";
 			gen_value ctx e);

Fișier diff suprimat deoarece este prea mare
+ 186 - 186
gencommon.ml


+ 1 - 1
gencpp.ml

@@ -2104,7 +2104,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
                | TClassDecl class_def when class_def.cl_extern -> add_extern_class class_def
 	            | _ -> add_type (t_path type_def)
                )
-					
+
 				(* Must visit the types, Type.iter will visit the expressions ... *)
 				| TTry (e,catches) ->
 					List.iter (fun (v,_) -> visit_type v.v_type) catches

+ 3 - 3
gencs.ml

@@ -78,7 +78,7 @@ let parse_explicit_iface =
     in
     get_iface split []
   in parse_explicit_iface
-	
+
 let is_string t =
   match follow t with
     | TInst( { cl_path = ([], "String") }, [] ) -> true
@@ -833,7 +833,7 @@ let configure gen =
             | TClassDecl { cl_path = (["haxe"], "Int32") } -> write w (path_s (["haxe"], "Int32"))
             | TClassDecl cl -> write w (t_s (TInst(cl, List.map (fun _ -> t_empty) cl.cl_types)))
             | TEnumDecl en -> write w (t_s (TEnum(en, List.map (fun _ -> t_empty) en.e_types)))
-            | TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_empty) td.t_types)))) 
+            | TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_empty) td.t_types))))
             | TAbstractDecl a -> write w (t_s (TAbstract(a, List.map (fun _ -> t_empty) a.a_types)))
           )
         | TParenthesis e ->
@@ -2001,7 +2001,7 @@ let configure gen =
   t()
 
 (* end of configure function *)
-	
+
 let before_generate con =
   ()
 

+ 2 - 2
genjava.ml

@@ -100,7 +100,7 @@ let parse_explicit_iface =
     in
     get_iface split []
   in parse_explicit_iface
-	
+
 let is_string t =
   match follow t with
     | TInst( { cl_path = ([], "String") }, [] ) -> true
@@ -1922,7 +1922,7 @@ let configure gen =
   t()
 
 (* end of configure function *)
-	
+
 let before_generate con =
   ()
 

+ 22 - 22
genphp.ml

@@ -203,7 +203,7 @@ let rec is_string_type t =
 
 let is_string_expr e = is_string_type e.etype
 
-let to_string ctx e = 
+let to_string ctx e =
 	let v = alloc_var "__call__" t_dynamic in
 	let f = mk (TLocal v) t_dynamic e.epos in
 	mk (TCall (f, [ Codegen.string ctx.com "_hx_string_rec" e.epos; e; Codegen.string ctx.com "" e.epos])) ctx.com.basic.tstring e.epos
@@ -214,20 +214,20 @@ let as_string_expr ctx e =
 		to_string ctx e
 	| _ when not (is_string_expr e) ->
 		to_string ctx e
-	| _ -> e 
+	| _ -> e
 
 let spr ctx s = Buffer.add_string ctx.buf s
 let print ctx = Printf.kprintf (fun s -> Buffer.add_string ctx.buf s)
 
 (*--php-prefix - added by skial bainn*)
-let prefix_class com name = 
+let prefix_class com name =
 	match com.php_prefix with
-	| Some prefix_class (* when not (String.length name <= 2 || String.sub name 0 2 = "__") *) -> 
+	| Some prefix_class (* when not (String.length name <= 2 || String.sub name 0 2 = "__") *) ->
 		prefix_class ^ name
 	| _ ->
 		name
 
-let prefix_init_replace com code = 
+let prefix_init_replace com code =
 	let r = Str.regexp "php_Boot" in
 	Str.global_replace r ("php_" ^ (prefix_class com "Boot")) code
 
@@ -447,7 +447,7 @@ let arg_is_opt c =
 	match c with
 	| Some _ -> true
 	| None -> false
-	
+
 let s_funarg ctx arg t p o =
 	let byref = if (String.length arg > 7 && String.sub arg 0 7 = "byref__") then "&" else "" in
 	print ctx "%s$%s" byref (s_ident_local arg);
@@ -544,7 +544,7 @@ and gen_call ctx e el =
 		gen_array_args ctx el;
 	| TLocal { v_name = "__prefix__" }, [] ->
 		(match ctx.com.php_prefix with
-		| Some prefix -> 
+		| Some prefix ->
 			print ctx "\"%s\"" prefix
 		| None ->
 			spr ctx "null")
@@ -1115,14 +1115,14 @@ and gen_expr ctx e =
 				gen_field_op ctx e2;
 				spr ctx ")";
 			end else if
-				(  
+				(
 					   se1 == se2
 					|| (match e1.eexpr with | TConst _ | TLocal _ | TArray _  | TNew _ -> true | _ -> false)
 					|| (match e2.eexpr with | TConst _ | TLocal _ | TArray _  | TNew _ -> true | _ -> false)
 					|| is_string_expr e1
 					|| is_string_expr e2
 					|| is_anonym_expr e1
-					|| is_anonym_expr e2 
+					|| is_anonym_expr e2
 					|| is_unknown_expr e1
 					|| is_unknown_expr e2
 				)
@@ -1714,14 +1714,14 @@ and canbe_ternary_param e =
 		cangen_ternary e eelse
 	| _ ->
 		false
-		
+
 and cangen_ternary e eelse =
-	match eelse with 
+	match eelse with
 	| Some other ->
 		(canbe_ternary_param e) && (canbe_ternary_param other)
-	| _ -> 
+	| _ ->
 		false
-		
+
 and gen_value ctx e =
 	match e.eexpr with
 	| TTypeExpr _
@@ -1750,14 +1750,14 @@ and gen_value ctx e =
 		gen_value ctx cond;
 		spr ctx " ? ";
 		gen_value ctx e;
-		
+
 		(match eelse with
 		| Some e ->
 			spr ctx " : ";
 			gen_value ctx e
 		| _ ->());
 		spr ctx ")";
-	
+
 (*
 	| TIf (cond,e,eelse) ->
 		spr ctx "if";
@@ -1796,7 +1796,7 @@ let rec is_instance_method_defined cls m =
 			is_instance_method_defined scls m
 		| None ->
 			false
-		
+
 let is_method_defined ctx m static =
 	if static then
 		PMap.exists m ctx.curclass.cl_statics
@@ -1823,7 +1823,7 @@ let gen_assigned_value ctx eo =	match eo with
 		gen_value ctx e
 	| _ ->
 		()
-	
+
 let generate_field ctx static f =
 	newline ctx;
 	ctx.locals <- PMap.empty;
@@ -2054,8 +2054,8 @@ let generate_class ctx c =
 	);
 
 	List.iter (generate_field ctx true) c.cl_ordered_statics;
-	
-	let gen_props props = 
+
+	let gen_props props =
 		String.concat "," (List.map (fun (p,v) -> "\"" ^ p ^ "\" => \"" ^ v ^ "\"") props)
 	in
 
@@ -2067,7 +2067,7 @@ let generate_class ctx c =
 		| None ->
 			list
 	in
-	
+
 	if not c.cl_interface then (match fields c with
 		| [] ->
 			()
@@ -2075,8 +2075,8 @@ let generate_class ctx c =
 			newline ctx;
 			print ctx "static $__properties__ = array(%s)" (gen_props props);
 		);
-		
-		
+
+
 	cl();
 	newline ctx;
 

+ 1 - 1
genswf8.ml

@@ -466,7 +466,7 @@ let define_var ctx v ef =
 let alloc_tmp ctx =
 	let r = alloc_reg ctx in
 	if ctx.flash6 then
-		let name = "$" ^ string_of_int r in		
+		let name = "$" ^ string_of_int r in
 		define_var ctx (alloc_var name t_dynamic) None;
 		TmpVar (name,r);
 	else

+ 1 - 1
genswf9.ml

@@ -358,7 +358,7 @@ let property ctx p t =
 			ns, None, false
 		with Not_found | Exit ->
 			ident p, None, false)
-			
+
 	| _ ->
 		ident p, None, false
 

+ 4 - 4
genxml.ml

@@ -85,8 +85,8 @@ let rec sexpr (e,_) =
 	| EObjectDecl fl -> "{" ^ (String.concat "," (List.map (fun (n,e) -> n ^ ":" ^ (sexpr e)) fl)) ^ "}"
 	| _ -> "'???'"
 
-let gen_meta meta = 
-	let meta = List.filter (fun (m,_,_) -> match m with ":?used" | ":realPath" -> false | _ -> true) meta in 
+let gen_meta meta =
+	let meta = List.filter (fun (m,_,_) -> match m with ":?used" | ":realPath" -> false | _ -> true) meta in
 	match meta with
 	| [] -> []
 	| _ ->
@@ -117,7 +117,7 @@ and gen_field att f =
 		| AccNormal | AccResolve | AccRequire _ -> att
 		| AccNo | AccNever -> (name, "null") :: att
 		| AccCall m -> (name,m) :: att
-		| AccInline -> (name,"inline") :: att		
+		| AccInline -> (name,"inline") :: att
 	in
 	let att = (match f.cf_expr with None -> att | Some e -> ("line",string_of_int (Lexer.get_error_line e.epos)) :: att) in
 	let att = (match f.cf_kind with
@@ -195,7 +195,7 @@ let gen_type_decl com pos t =
 		let doc = gen_doc_opt a.a_doc in
 		let meta = gen_meta a.a_meta in
 		let sub = (match a.a_sub with [] -> [] | l -> [node "sub" [] (List.map gen_type l)]) in
-		let super = (match a.a_super with [] -> [] | l -> [node "super" [] (List.map gen_type l)]) in		
+		let super = (match a.a_super with [] -> [] | l -> [node "super" [] (List.map gen_type l)]) in
 		node "abstract" (gen_type_params pos a.a_private (tpath t) a.a_types a.a_pos m) (sub @ super @ doc @ meta)
 
 let att_str att =

+ 2 - 2
interp.ml

@@ -517,7 +517,7 @@ let neko =
 
 	(* a bit tricky since load "val_true" does not work as expected on Windows *)
 	let unser = try loadprim "std@unserialize" 2 with _ -> ("",null,0) in
-	
+
 	(* did we fail to load std.ndll ? *)
 	if (match unser with ("",_,_) -> true | _ -> false) then None else
 
@@ -4013,7 +4013,7 @@ let rec encode_mtype t fields =
 
 and encode_type_params tl =
 	enc_array (List.map (fun (n,t) -> enc_obj ["name",enc_string n;"t",encode_type t]) tl)
-	
+
 and encode_tenum e =
 	encode_mtype (TEnumDecl e) [
 		"isExtern", VBool e.e_extern;

+ 1 - 1
lexer.mll

@@ -112,7 +112,7 @@ let add_fmt_string p =
 let fast_add_fmt_string p =
 	let cur = !cur in
 	cur.lstrings <- (fmt_pos p) :: cur.lstrings
-	
+
 let is_fmt_string p =
 	try
 		let file = Hashtbl.find all_files p.pfile in

+ 2 - 2
main.ml

@@ -840,7 +840,7 @@ try
 			Genswf.add_swf_lib com file true
 		),"<file> : use the SWF library for type checking");
 		("-java-lib",Arg.String (fun file ->
-			Genjava.add_java_lib com file 
+			Genjava.add_java_lib com file
 		),"<file> : add an external JAR or class directory library");
 		("-x", Arg.String (fun file ->
 			let neko_file = file ^ ".n" in
@@ -1160,7 +1160,7 @@ try
 			Gencs.generate com;
 		| Java ->
       Common.log com ("Generating Cs in : " ^ com.file);
-			Genjava.generate com; 
+			Genjava.generate com;
 		);
 	end;
 	Sys.catch_break false;

+ 14 - 14
matcher.ml

@@ -244,7 +244,7 @@ let to_pattern ctx e t =
 		if PMap.mem s tctx.pc_locals then verror s p;
 		tctx.pc_locals <- PMap.add s v tctx.pc_locals;
 		v
-	in	
+	in
 	let rec loop tctx e t = match e with
 		| EParenthesis(e),_ ->
 			loop tctx e t
@@ -265,8 +265,8 @@ let to_pattern ctx e t =
 					| TFun _,_ ->
 						error "Invalid number of arguments to extractor, must be exactly 1" p
 					| _ ->
-						error "Invalid type for method unapply" cf.cf_pos)			
-				| _ -> perror p)				
+						error "Invalid type for method unapply" cf.cf_pos)
+				| _ -> perror p)
 			| TEnum(en,pl)
 			| TFun(_,TEnum(en,pl)) ->
 				let ef = match ec.eexpr with
@@ -337,7 +337,7 @@ let to_pattern ctx e t =
 						(match tc with
 							| TMono _ -> ()
 							| _ -> try unify_raise ctx e.etype tc e.epos with Error (Unify _,_) -> raise Not_found);
-						e 
+						e
 				in
 				(match ec.eexpr with
 					| TEnumField(en,s)
@@ -352,7 +352,7 @@ let to_pattern ctx e t =
 					| _ ->
 						raise Not_found);
 			with Not_found ->
-				let v = mk_var tctx s t p in 
+				let v = mk_var tctx s t p in
 				{
 					pdef = PatVar(SVar v,p);
 					ptype = t;
@@ -444,7 +444,7 @@ let rec collapse_pattern pl = match pl with
 			ptype = pat.ptype
 		}
 	| [] ->
-		assert false	
+		assert false
 
 (* Calculates the specialization matrix of pmat for constructor c *)
 let spec mctx (c : con) (pmat : pattern_matrix) : pattern_matrix =
@@ -559,7 +559,7 @@ let all_ctors ctx t =
 	| TAbstract({a_path = [],"Bool"},_) ->
 		h := PMap.add (CConst(TBool true)) Ast.null_pos !h;
 		h := PMap.add (CConst(TBool false)) Ast.null_pos !h;
-		false	
+		false
 	| TInst({cl_path=[],"String"},_)
 	| TInst({cl_path=[],"Array"},_)
 	| TAbstract _ ->
@@ -620,7 +620,7 @@ let rec compile mctx (stl : subterm list) (n : int) (pmat : pattern_matrix) = ma
 					let a2 = a - i - 1 in
 					let args = (ExtList.List.make i any) @ [pat] @ (if a2 > 0 then (ExtList.List.make (a - i - 1) any) else []) in
 					let pattern = mk_con_pat (fst c) args t_dynamic (pos c) in
-					raise (Not_exhaustive(pattern,i))				
+					raise (Not_exhaustive(pattern,i))
 			) sigma in
 			if not inf && PMap.is_empty !c_all then Switch (st_head,t,cases) else begin
 				let pmat_def = default mctx pmat in
@@ -663,7 +663,7 @@ let replace_locals ctx out e =
 		let v2 = List.assq v subst in
 		Hashtbl.remove all_subterms v2;
 		v2
-	in 
+	in
 	let rec loop e = match e.eexpr with
 		| TLocal v ->
 			(try
@@ -737,7 +737,7 @@ and to_enum_switch ctx need_val st en pl cases =
 			Some ([ef.ef_index],vl,e)
 		| CConst TNull ->
 			def := Some (to_typed_ast ctx need_val dt);
-			None			
+			None
 		| c ->
 			error ("Unexpected "  ^ (s_con c)) p
 	) cases in
@@ -791,10 +791,10 @@ and to_array_switch ctx need_val st t cases =
 			def := Some (to_typed_ast ctx need_val dt);
 			None
 		| c ->
-			error ("Unexpected "  ^ (s_con c)) p			
+			error ("Unexpected "  ^ (s_con c)) p
 	) cases in
 	let el = (List.map (fun (_,e) -> e) cases) @ match !def with None -> [] | Some e -> [e] in
-	let t = if not need_val then (mk_mono()) else unify_min ctx (List.rev el) in	
+	let t = if not need_val then (mk_mono()) else unify_min ctx (List.rev el) in
 	let e_eval = mk (TField(e_var,"length")) ctx.com.basic.tint p in
 	mk (TSwitch(e_eval,cases,!def)) t p
 
@@ -821,7 +821,7 @@ and to_typed_ast ctx need_val (dt : decision_tree) : texpr =
 			to_array_switch ctx need_val st t cases;
 		| (TInst({cl_path=[],"String"},_) as t)
 		| (TAbstract _ as t) ->
-			to_value_switch ctx need_val st t cases			
+			to_value_switch ctx need_val st t cases
 		| TAnon {a_fields = fields}
 		| TInst({cl_fields = fields},_) ->
 			to_anon_switch ctx need_val st fields cases
@@ -876,7 +876,7 @@ let match_expr ctx e cases def need_val with_type p =
 			| EConst(Ident "_"),evals -> List.map (fun eval -> mk_any eval.etype (pos epat)) evals
 			| _,_ :: _ :: [] -> error "This kind of binding is not allowed because we do not have tuples" (pos epat);
 			| _,_ -> [to_pattern ctx epat (List.hd evals).etype]
-		in		
+		in
 		let e = type_expr ctx e need_val in
 		let eg = match eg with
 			| None -> None

+ 1 - 1
parser.ml

@@ -954,7 +954,7 @@ type small_type =
 	| TBool of bool
 	| TFloat of float
 	| TString of string
-	
+
 let parse ctx code =
 	let old = Lexer.save() in
 	let old_cache = !cache in

+ 1 - 1
typer.ml

@@ -2851,7 +2851,7 @@ let get_type_patch ctx t sub =
 			let tp = new_patch() in
 			Hashtbl.add h k tp;
 			tp
-	
+
 let macro_timer ctx path =
 	Common.timer (if Common.defined ctx.com Define.MacroTimes then "macro " ^ path else "macro execution")
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff