瀏覽代碼

define properties in interfaces

Nicolas Cannasse 15 年之前
父節點
當前提交
81c4228ad2
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 1 0
      doc/CHANGES.txt
  2. 9 0
      genas3.ml

+ 1 - 0
doc/CHANGES.txt

@@ -38,6 +38,7 @@
 	all : allow sub-types declarations everywhere (pack.Type.Sub)
 	all : added completion for sub-types declarations
 	all : improved completion with lambda function
+	as3 : several generation fixes
 
 2009-07-26: 2.04
 	flash9 : fixed get_full_path error with -D fdb

+ 9 - 0
genas3.ml

@@ -856,6 +856,15 @@ let generate_field ctx static f =
 					if o then print ctx " = %s" (default_value tstr);
 				) args;
 				print ctx ") : %s " (type_str ctx r p);
+			| _ when (match f.cf_get with CallAccess m -> true | _ -> match f.cf_set with CallAccess m -> true | _ -> false) -> 
+				let t = type_str ctx f.cf_type p in
+				let id = s_ident f.cf_name in
+				(match f.cf_get with
+				| NormalAccess | CallAccess _ -> print ctx "function get %s() : %s;" id t;
+				| _ -> ());
+				(match f.cf_set with
+				| NormalAccess | CallAccess _ -> print ctx "function set %s( __v : %s ) : void;" id t;
+				| _ -> ());
 			| _ -> ()
 		else
 		if (match f.cf_get with CallAccess m -> true | _ -> match f.cf_set with CallAccess m -> true | _ -> false) then begin