Bläddra i källkod

fix overloads even more

Simon Krajewski 1 år sedan
förälder
incheckning
6c23352a9e
3 ändrade filer med 13 tillägg och 14 borttagningar
  1. 1 1
      src/compiler/hxb/hxbReader.ml
  2. 11 12
      src/compiler/hxb/hxbShared.ml
  3. 1 1
      src/compiler/hxb/hxbWriter.ml

+ 1 - 1
src/compiler/hxb/hxbReader.ml

@@ -1405,7 +1405,7 @@ class hxb_reader
 						try
 							Hashtbl.find instance_overload_cache key
 						with Not_found ->
-							let l = get_instance_overloads c cf in
+							let l = get_instance_overloads c cf.cf_name in
 							Hashtbl.add instance_overload_cache key l;
 							l
 				in

+ 11 - 12
src/compiler/hxb/hxbShared.ml

@@ -1,25 +1,24 @@
 open Type
 
-let get_instance_overloads c cf =
+let get_instance_overloads c name =
 	let acc = DynArray.create () in
-	let rec loop c cf =
+	let rec loop c =
 		ignore(c.cl_build());
-		List.iter (DynArray.add acc) (cf :: cf.cf_overloads);
-		let maybe_recurse c =
-			try
-				loop c (PMap.find cf.cf_name c.cl_fields)
-			with Not_found ->
-				()
-		in
+		begin try
+			let cf = PMap.find name c.cl_fields in
+			List.iter (DynArray.add acc) (cf :: cf.cf_overloads);
+		with Not_found ->
+			()
+		end;
 		if has_class_flag c CInterface then
 			List.iter (fun (c,_) ->
-				maybe_recurse c
+				loop c
 			) c.cl_implements
 		else match c.cl_super with
 			| Some(c,_) ->
-				maybe_recurse c
+				loop c
 			| None ->
 				()
 	in
-	loop c cf;
+	loop c;
 	DynArray.to_list acc

+ 1 - 1
src/compiler/hxb/hxbWriter.ml

@@ -389,7 +389,7 @@ class ['a] hxb_writer
 						try
 							Hashtbl.find instance_overload_cache key
 						with Not_found ->
-							let l = get_instance_overloads c cf_base in
+							let l = get_instance_overloads c cf_base.cf_name in
 							Hashtbl.add instance_overload_cache key l;
 							l
 				in