Sfoglia il codice sorgente

[gencommon] get rid of Gencommon dependency for SetHXGen filter

Dan Korostelev 8 anni fa
parent
commit
f1f12abdcc

+ 4 - 5
src/generators/gencommon/setHXGen.ml

@@ -18,7 +18,6 @@
 *)
 open Common
 open Type
-open Gencommon
 
 (* ******************************************* *)
 (* set hxgen module *)
@@ -33,7 +32,7 @@ open Gencommon
 	The only option is to run this filter eagerly, because it must be one of the first filters to run,
 	since many others depend of it.
 *)
-let run_filter gen =
+let run_filter com types =
 	let rec is_hxgen md =
 		match md with
 		| TClassDecl { cl_kind = KAbstractImpl a } ->
@@ -70,7 +69,7 @@ let run_filter gen =
 				if Meta.has Meta.FlatEnum e.e_meta then
 					false
 				else begin
-					gen.gcon.error "Only flat enums may be @:nativeGen" e.e_pos;
+					com.error "Only flat enums may be @:nativeGen" e.e_pos;
 					true
 				end
 			else
@@ -80,7 +79,7 @@ let run_filter gen =
 		| TAbstractDecl a ->
 			(match follow a.a_this with
 			| TInst _ | TEnum _ | TAbstract _ ->
-				is_hxgen (t_to_md (follow a.a_this))
+				is_hxgen (module_type_of_type (follow a.a_this))
 			| _ ->
 				not (Meta.has Meta.NativeGen a.a_meta))
 		| TTypeDecl t -> (* TODO see when would we use this *)
@@ -96,4 +95,4 @@ let run_filter gen =
 		| TAbstractDecl a -> a.a_meta <- (meta, [], a.a_pos) :: a.a_meta
 	in
 
-	List.iter filter gen.gtypes_list
+	List.iter filter types

+ 1 - 1
src/generators/gencs.ml

@@ -2615,7 +2615,7 @@ let configure gen =
 	gen.greal_type <- real_type;
 	gen.greal_type_param <- change_param_type;
 
-	SetHXGen.run_filter gen;
+	SetHXGen.run_filter gen.gcon gen.gtypes_list;
 
 	(* before running the filters, follow all possible types *)
 	(* this is needed so our module transformations don't break some core features *)

+ 1 - 1
src/generators/genjava.ml

@@ -2037,7 +2037,7 @@ let configure gen =
 	gen.greal_type <- real_type;
 	gen.greal_type_param <- change_param_type;
 
-	SetHXGen.run_filter gen;
+	SetHXGen.run_filter gen.gcon gen.gtypes_list;
 
 	(* before running the filters, follow all possible types *)
 	(* this is needed so our module transformations don't break some core features *)