瀏覽代碼

fixed issue with flash9 enums

Nicolas Cannasse 16 年之前
父節點
當前提交
b36c370558
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 1 0
      doc/CHANGES.txt
  2. 7 3
      genswf9.ml

+ 1 - 0
doc/CHANGES.txt

@@ -29,6 +29,7 @@ TODO :
 	genAS3 : fixed Error classes issues
 	genAS3 : fixed default basic type value in interfaces
 	flash9 : fixed UInt default parameter verify error
+	flash9 : fixed issue with flash.* string enums verify error
 	compiler : allowed \r line separators for HXML files
 
 2008-11-23: 2.02

+ 7 - 3
genswf9.ml

@@ -170,6 +170,10 @@ let type_path ctx path =
 	let pack, name = real_path path in
 	HMPath (pack,name)
 
+let is_int_enum = function
+	| "ActionScriptVersion" | "SWFVersion" | "EventPhase" | "KeyLocation" | "XmlNodeType" -> true
+	| _ -> false
+
 let rec follow_basic t =
 	match t with
 	| TMono r ->
@@ -217,6 +221,8 @@ let rec type_id ctx t =
 	| TEnum ({ e_path = ([],"Bool") as path },_)
 	| TType ({ t_path = ([],"UInt") as path },_) ->
 		type_path ctx path
+	| TEnum ({ e_path = ("flash" :: _,name); e_extern = true },_) ->
+		HMPath ([],if is_int_enum name then "int" else "String")
 	| _ ->
 		HMPath ([],"Object")
 
@@ -239,9 +245,7 @@ let classify ctx t =
 	| TEnum ({ e_path = [],"Bool" },_) ->
 		KBool
 	| TEnum ({ e_extern = true; e_path = "flash" :: _ , name },[]) ->
-		(match name with
-		| "ActionScriptVersion" | "SWFVersion" | "EventPhase" | "KeyLocation" | "XmlNodeType" -> KInt
-		| _ -> KType (HMPath ([],"String")))
+		if is_int_enum name then KInt else KType (HMPath ([],"String"))
 	| TEnum _
 	| TInst _ ->
 		KType (type_id ctx t)