Browse Source

recursively replace interfaces but respect `@:keep`

Simon Krajewski 9 năm trước cách đây
mục cha
commit
20c2641d30
2 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 3 3
      filters.ml
  2. 1 0
      tests/unit/src/unit/TestOverloads.hx

+ 3 - 3
filters.ml

@@ -1101,9 +1101,9 @@ let check_remove_metadata ctx t = match t with
 
 
 let do_the_tivo_thing ctx =
-	let get_substitute_class c = match c.cl_dependent with
-		| [({cl_params = []} as c2),[]] when c.cl_interface && c.cl_params = [] && not c.cl_extern ->
-			c2
+	let rec get_substitute_class c = match c.cl_dependent with
+		| [({cl_params = []} as c2),[]] when c.cl_interface && c.cl_params = [] && not c.cl_extern && not (Meta.has Meta.Keep c.cl_meta) ->
+			get_substitute_class c2
 		| _ -> c
 	in
 	let rec substitute_type t = match follow t with

+ 1 - 0
tests/unit/src/unit/TestOverloads.hx

@@ -268,6 +268,7 @@ private class Primitives
 #end
 }
 
+@:keep
 private interface I0
 {
 }