Browse Source

remove unused r argument from lazy functions

Simon Krajewski 9 months ago
parent
commit
924ff1797f

+ 2 - 2
src/context/typecore.ml

@@ -508,7 +508,7 @@ let make_lazy ?(force=true) ctx t_proc f where =
 	r := lazy_wait (fun() ->
 		try
 			r := lazy_processing t_proc;
-			let t = f r in
+			let t = f () in
 			r := lazy_available t;
 			t
 		with
@@ -898,7 +898,7 @@ let make_lazy ?(force=true) ctx t f (where:string) =
 	r := lazy_wait (make_pass ~inf:(make_where ctx where) ctx (fun() ->
 		try
 			r := lazy_processing t;
-			let t = f r in
+			let t = f () in
 			r := lazy_available t;
 			t
 		with

+ 1 - 1
src/typing/generic.ml

@@ -363,7 +363,7 @@ let build_generic_class ctx c p tl =
 				t
 			in
 			let t = spawn_monomorph ctx.e p in
-			let r = make_lazy ctx.g t (fun r ->
+			let r = make_lazy ctx.g t (fun () ->
 				let t0 = f() in
 				unify_raise t0 t p;
 				link_dynamic t0 t;

+ 1 - 1
src/typing/instanceBuilder.ml

@@ -74,7 +74,7 @@ let get_build_info ctx mtype p =
 		if ctx.pass > PBuildClass then ignore(c.cl_build());
 		let build f s tl =
 			let t = spawn_monomorph ctx.e p in
-			let r = make_lazy ctx.g t (fun r ->
+			let r = make_lazy ctx.g t (fun () ->
 				let tf = f tl in
 				unify_raise tf t p;
 				link_dynamic t tf;

+ 3 - 3
src/typing/typeload.ml

@@ -459,7 +459,7 @@ and load_complex_type' ctx allow_display mode (t,p) =
 		) tl in
 		let tr = Monomorph.create() in
 		let t = TMono tr in
-		let r = make_lazy ctx.g t (fun r ->
+		let r = make_lazy ctx.g t (fun () ->
 			let ta = make_extension_type ctx tl in
 			Monomorph.bind tr ta;
 			ta
@@ -500,7 +500,7 @@ and load_complex_type' ctx allow_display mode (t,p) =
 			) tl in
 			let tr = Monomorph.create() in
 			let t = TMono tr in
-			let r = make_lazy ctx.g t (fun r ->
+			let r = make_lazy ctx.g t (fun () ->
 				Monomorph.bind tr (match il with
 					| [i] ->
 						mk_extension i
@@ -731,7 +731,7 @@ and type_type_params ctx host path tpl =
 			| None ->
 				()
 			| Some ct ->
-				let r = make_lazy ctx.g ttp.ttp_type (fun r ->
+				let r = make_lazy ctx.g ttp.ttp_type (fun () ->
 					let t = load_complex_type ctx true LoadNormal ct in
 					begin match host with
 						| TPHType ->

+ 6 - 6
src/typing/typeloadFields.ml

@@ -748,7 +748,7 @@ module TypeBinding = struct
 					mk_cast e cf.cf_type e.epos
 			end
 		in
-		let r = make_lazy ~force:false ctx.g t (fun r ->
+		let r = make_lazy ~force:false ctx.g t (fun () ->
 			(* type constant init fields (issue #1956) *)
 			if not ctx.g.return_partial_type || (match fst e with EConst _ -> true | _ -> false) then begin
 				enter_field_typing_pass ctx.g ("bind_var_expression",fst ctx.c.curclass.cl_path @ [snd ctx.c.curclass.cl_path;ctx.f.curfield.cf_name]);
@@ -827,7 +827,7 @@ module TypeBinding = struct
 	let bind_method ctx_f cctx fctx fmode cf t args ret e p =
 		let c = cctx.tclass in
 		let ctx = TyperManager.clone_for_expr ctx_f fmode true in
-		let bind r =
+		let bind () =
 			incr stats.s_methods_typed;
 			if (Meta.has (Meta.Custom ":debug.typing") (c.cl_meta @ cf.cf_meta)) then ctx.com.print (Printf.sprintf "Typing method %s.%s\n" (s_type_path c.cl_path) cf.cf_name);
 			begin match ctx.com.platform with
@@ -873,8 +873,8 @@ module TypeBinding = struct
 					check_field_display ctx fctx c cf;
 			end;
 		in
-		let maybe_bind r =
-			if not ctx.g.return_partial_type then bind r;
+		let maybe_bind () =
+			if not ctx.g.return_partial_type then bind ();
 			t
 		in
 		let r = make_lazy ~force:false ctx.g t maybe_bind "type_fun" in
@@ -936,7 +936,7 @@ let check_abstract (ctx,cctx,fctx) a c cf fd t ret p =
 		fctx.expr_presence_matters <- true;
 	end in
 	let handle_from () =
-		let r = make_lazy ctx.g t (fun r ->
+		let r = make_lazy ctx.g t (fun () ->
 			(* the return type of a from-function must be the abstract, not the underlying type *)
 			if not fctx.is_macro then (try type_eq EqStrict ret ta with Unify_error l -> raise_typing_error_ext (make_error (Unify l) p));
 			match t with
@@ -976,7 +976,7 @@ let check_abstract (ctx,cctx,fctx) a c cf fd t ret p =
 		let is_multitype_cast = Meta.has Meta.MultiType a.a_meta && not fctx.is_abstract_member in
 		if is_multitype_cast && not (Meta.has Meta.MultiType cf.cf_meta) then
 			cf.cf_meta <- (Meta.MultiType,[],null_pos) :: cf.cf_meta;
-		let r = make_lazy ctx.g t (fun r ->
+		let r = make_lazy ctx.g t (fun () ->
 			let args = if is_multitype_cast then begin
 				let ctor = try
 					PMap.find "_new" c.cl_statics

+ 1 - 1
src/typing/typeloadFunction.ml

@@ -175,7 +175,7 @@ let add_constructor ctx_c c force_constructor p =
 		cf.cf_params <- cfsup.cf_params;
 		cf.cf_meta <- List.filter (fun (m,_,_) -> m = Meta.CompilerGenerated) cfsup.cf_meta;
 		let t = spawn_monomorph ctx_c.e p in
-		let r = make_lazy ctx_c.g t (fun r ->
+		let r = make_lazy ctx_c.g t (fun () ->
 			let ctx = TyperManager.clone_for_field ctx_c cf cf.cf_params in
 			ignore (follow cfsup.cf_type); (* make sure it's typed *)
 			List.iter (fun cf -> ignore (follow cf.cf_type)) cf.cf_overloads;

+ 2 - 2
src/typing/typeloadModule.ml

@@ -557,7 +557,7 @@ module TypeLevel = struct
 					| _ ->
 						()
 				in
-				let r = make_lazy ctx_td.g tt (fun r ->
+				let r = make_lazy ctx_td.g tt (fun () ->
 					check_rec tt;
 					tt
 				) "typedef_rec_check" in
@@ -591,7 +591,7 @@ module TypeLevel = struct
 			let t = load_complex_type ctx_a true LoadNormal t in
 			let t = if not (Meta.has Meta.CoreType a.a_meta) then begin
 				if !is_type then begin
-					let r = make_lazy ctx_a.g t (fun r ->
+					let r = make_lazy ctx_a.g t (fun () ->
 						(try (if from then Type.unify t a.a_this else Type.unify a.a_this t) with Unify_error _ -> raise_typing_error "You can only declare from/to with compatible types" pos);
 						t
 					) "constraint" in