Browse Source

fixes for Dynamic types

Nicolas Cannasse 17 years ago
parent
commit
478300ee58
2 changed files with 11 additions and 10 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 10 10
      genswf9.ml

+ 1 - 0
doc/CHANGES.txt

@@ -5,6 +5,7 @@
 	added haxe.FastList
 	added haxe.FastList
 	bugfix to prevent recursive anonymous
 	bugfix to prevent recursive anonymous
 	fixed some incorrectly reported "recursive inline" errors
 	fixed some incorrectly reported "recursive inline" errors
+	fixes in genas3 + genswf9 for Dynamic/* in methods
 	TODO haxe/f9 : inline code can give bad file in debug infos
 	TODO haxe/f9 : inline code can give bad file in debug infos
 	TODO haxe/f9 var x = if( true ) Math.POSITIVE_INFINITY : 0.; VerifyError
 	TODO haxe/f9 var x = if( true ) Math.POSITIVE_INFINITY : 0.; VerifyError
 
 

+ 10 - 10
genswf9.ml

@@ -196,12 +196,16 @@ let type_id ctx t =
 	| _ ->
 	| _ ->
 		HMPath ([],"Object")
 		HMPath ([],"Object")
 
 
-let type_void ctx t =
+let type_opt ctx t =
 	match follow t with
 	match follow t with
-	| TEnum ({ e_path = [],"Void" },_) -> Some (HMPath ([],"void"))
 	| TDynamic _ -> None
 	| TDynamic _ -> None
 	| _ -> Some (type_id ctx t)
 	| _ -> Some (type_id ctx t)
 
 
+let type_void ctx t =
+	match follow t with
+	| TEnum ({ e_path = [],"Void" },_) -> Some (HMPath ([],"void"))
+	| _ -> type_opt ctx t
+
 let classify ctx t =
 let classify ctx t =
 	match follow_basic t with
 	match follow_basic t with
 	| TInst ({ cl_path = [],"Int" },_) ->
 	| TInst ({ cl_path = [],"Int" },_) ->
@@ -523,20 +527,16 @@ let begin_fun ctx args tret el stat p =
 					hltc_start = t.tr_pos + delta;
 					hltc_start = t.tr_pos + delta;
 					hltc_end = t.tr_end + delta;
 					hltc_end = t.tr_end + delta;
 					hltc_handle = t.tr_catch_pos + delta;
 					hltc_handle = t.tr_catch_pos + delta;
-					hltc_type = (match follow t.tr_type with
-						| TInst (c,_) -> Some (type_path ctx c.cl_path)
-						| TEnum (e,_) -> Some (type_path ctx e.e_path)
-						| TDynamic _ -> None
-						| _ -> assert false);
+					hltc_type = type_opt ctx t.tr_type;
 					hltc_name = None;
 					hltc_name = None;
 				}
 				}
 			) (List.rev ctx.trys));
 			) (List.rev ctx.trys));
-			hlf_locals = Array.of_list (List.map (fun (id,name,t) -> ident name, Some (type_id ctx t), id) ctx.block_vars);
+			hlf_locals = Array.of_list (List.map (fun (id,name,t) -> ident name, type_opt ctx t, id) ctx.block_vars);
 		} in
 		} in
 		let mt = {
 		let mt = {
 			hlmt_mark = As3hlparse.alloc_mark();
 			hlmt_mark = As3hlparse.alloc_mark();
 			hlmt_ret = type_void ctx tret;
 			hlmt_ret = type_void ctx tret;
-			hlmt_args = List.map (fun (_,_,t) -> type_void ctx t) args;
+			hlmt_args = List.map (fun (_,_,t) -> type_opt ctx t) args;
 			hlmt_native = false;
 			hlmt_native = false;
 			hlmt_var_args = varargs;
 			hlmt_var_args = varargs;
 			hlmt_debug_name = None;
 			hlmt_debug_name = None;
@@ -1386,7 +1386,7 @@ let generate_field_kind ctx f c stat =
 		None
 		None
 	| _ ->
 	| _ ->
 		Some (HFVar {
 		Some (HFVar {
-			hlv_type = Some (type_id ctx f.cf_type);
+			hlv_type = type_opt ctx f.cf_type;
 			hlv_value = HVNone;
 			hlv_value = HVNone;
 			hlv_const = false;
 			hlv_const = false;
 		})
 		})