Browse Source

define properties in interfaces

Nicolas Cannasse 15 years ago
parent
commit
81c4228ad2
2 changed files with 10 additions and 0 deletions
  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 : allow sub-types declarations everywhere (pack.Type.Sub)
 	all : added completion for sub-types declarations
 	all : added completion for sub-types declarations
 	all : improved completion with lambda function
 	all : improved completion with lambda function
+	as3 : several generation fixes
 
 
 2009-07-26: 2.04
 2009-07-26: 2.04
 	flash9 : fixed get_full_path error with -D fdb
 	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);
 					if o then print ctx " = %s" (default_value tstr);
 				) args;
 				) args;
 				print ctx ") : %s " (type_str ctx r p);
 				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
 		else
 		if (match f.cf_get with CallAccess m -> true | _ -> match f.cf_set with CallAccess m -> true | _ -> false) then begin
 		if (match f.cf_get with CallAccess m -> true | _ -> match f.cf_set with CallAccess m -> true | _ -> false) then begin