Răsfoiți Sursa

a bit more abstract support changes

Nicolas Cannasse 13 ani în urmă
părinte
comite
7614c655ca
4 a modificat fișierele cu 10 adăugiri și 6 ștergeri
  1. 2 2
      genas3.ml
  2. 4 0
      gencpp.ml
  3. 1 1
      genphp.ml
  4. 3 3
      genswf9.ml

+ 2 - 2
genas3.ml

@@ -577,7 +577,7 @@ and gen_expr ctx e =
 		(match eo with
 		| None ->
 			spr ctx "return"
-		| Some e when (match follow e.etype with TEnum({ e_path = [],"Void" },[]) -> true | _ -> false) ->
+		| Some e when (match follow e.etype with TEnum({ e_path = [],"Void" },[]) | TAbstract ({ a_path = [],"Void" },[]) -> true | _ -> false) ->
 			print ctx "{";
 			let bend = open_block ctx in
 			newline ctx;
@@ -1210,7 +1210,7 @@ let generate com =
 		| TEnumDecl e ->
 			let pack,name = e.e_path in
 			let e = { e with e_path = (pack,protect name) } in
-			if e.e_extern && e.e_path <> ([],"Void") then
+			if e.e_extern then
 				()
 			else
 				let ctx = init infos e.e_path in

+ 4 - 0
gencpp.ml

@@ -365,6 +365,10 @@ let rec class_string klass suffix params =
 and type_string_suff suffix haxe_type =
 	(match haxe_type with
 	| TMono r -> (match !r with None -> "Dynamic" ^ suffix | Some t -> type_string_suff suffix t)
+	| TAbstract ({ a_path = ([],"Void") },[]) -> "Void"
+	| TAbstract ({ a_path = ([],"Bool") },[]) -> "bool"
+	| TAbstract ({ a_path = ([],"Float") },[]) -> "Float"
+	| TAbstract ({ a_path = ([],"Int") },[]) -> "int"
 	| TEnum ({ e_path = ([],"Void") },[]) -> "Void"
 	| TEnum ({ e_path = ([],"Bool") },[]) -> "bool"
 	| TInst ({ cl_path = ([],"Float") },[]) -> "Float"

+ 1 - 1
genphp.ml

@@ -1199,7 +1199,7 @@ and gen_expr ctx e =
 		(match eo with
 		| None ->
 			spr ctx "return"
-		| Some e when (match follow e.etype with TEnum({ e_path = [],"Void" },[]) -> true | _ -> false) ->
+		| Some e when (match follow e.etype with TEnum({ e_path = [],"Void" },[]) | TAbstract ({ a_path = [],"Void" },[]) -> true | _ -> false) ->
 			gen_value ctx e;
 			newline ctx;
 			spr ctx "return"

+ 3 - 3
genswf9.ml

@@ -240,7 +240,7 @@ let type_opt ctx t =
 
 let type_void ctx t =
 	match follow t with
-	| TEnum ({ e_path = [],"Void" },_) -> Some (HMPath ([],"void"))
+	| TEnum ({ e_path = [],"Void" },_) | TAbstract ({ a_path = [],"Void" },_) -> Some (HMPath ([],"void"))
 	| _ -> type_opt ctx t
 
 let classify ctx t =
@@ -1648,7 +1648,7 @@ and generate_function ctx fdata stat =
 	let f = begin_fun ctx fdata.tf_args fdata.tf_type [fdata.tf_expr] stat fdata.tf_expr.epos in
 	gen_expr ctx false fdata.tf_expr;
 	(match follow fdata.tf_type with
-	| TEnum ({ e_path = [],"Void" },[]) ->
+	| TEnum ({ e_path = [],"Void" },[]) | TAbstract ({ a_path = [],"Void" },[]) ->
 		debug_infos ctx ~is_min:false fdata.tf_expr.epos;
 		write ctx HRetVoid
 	| _ ->
@@ -2297,7 +2297,7 @@ let generate_type ctx t =
 				hlf_metas = extract_meta c.cl_meta;
 			})
 	| TEnumDecl e ->
-		if e.e_extern && e.e_path <> ([],"Void") then
+		if e.e_extern then
 			None
 		else
 			let meta = Codegen.build_metadata ctx.com t in