Browse Source

fixed f9 verify error with different kind of functions

Nicolas Cannasse 16 năm trước cách đây
mục cha
commit
510eb4192f
2 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 1 0
      doc/CHANGES.txt
  2. 6 6
      genswf9.ml

+ 1 - 0
doc/CHANGES.txt

@@ -20,6 +20,7 @@ TODO :
 	fixed issues with unset of values in for loops and executing blocks that return functions (haXe/PHP)
 	"throw" type is now Unknown instead of Dynamic (prevent type-hole in "if A else if B else throw")
 	added __foreach__ for flash9/as3
+	fixed f9 verify error with different kind of functions
 
 2008-11-23: 2.02
 	Std.is(MyInterface, Class) now returns true (haXe/PHP)

+ 6 - 6
genswf9.ml

@@ -732,17 +732,17 @@ let gen_access ctx e (forset : 'a) : 'a access =
 		| _ -> gen_expr ctx true e1);
 		(match k with
 		| Some t -> VCast (id,t)
-		| None ->
-		match follow e1.etype with
-		| TEnum _ -> VId id
-		| TInst (_,tl) ->
-			let et = follow e.etype in
+		| None -> 
+		match follow e1.etype, follow e.etype with
+		| _ , TFun _ -> VCast(id,classify ctx e.etype)
+		| TEnum _, _ -> VId id
+		| TInst (_,tl), et ->
 			(* if the return type is one of the type-parameters, then we need to cast it *)
 			if List.exists (fun t -> follow t == et) tl then
 				VCast (id, classify ctx et)
 			else
 				VId id
-		| TAnon a when (match !(a.a_status) with Statics _ | EnumStatics _ -> true | _ -> false) -> VId id
+		| TAnon a, _ when (match !(a.a_status) with Statics _ | EnumStatics _ -> true | _ -> false) -> VId id
 		| _ -> VCast (id,classify ctx e.etype))
 	| TArray ({ eexpr = TLocal "__global__" },{ eexpr = TConst (TString s) }) ->
 		let path = (match List.rev (ExtString.String.nsplit s ".") with [] -> assert false | x :: l -> List.rev l, x) in