Browse Source

use namespace for interfaces

Nicolas Cannasse 15 years ago
parent
commit
01d9e7335d
2 changed files with 16 additions and 15 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 15 15
      genswf9.ml

+ 1 - 0
doc/CHANGES.txt

@@ -25,6 +25,7 @@
 	php : fixed issue with Reflect.callMethod
 	php : fixed issue with PHP reserved word used in callbacks
 	all : bugfix with non-constant enums in switches
+	flash9 : fix for interfaces (use namespace)
 
 2009-07-26: 2.04
 	flash9 : fixed get_full_path error with -D fdb

+ 15 - 15
genswf9.ml

@@ -165,7 +165,7 @@ let real_path = function
 	| ["flash"] , "Error" -> [], "Error"
 	| ["flash"] , "Vector" -> ["__AS3__";"vec"], "Vector"
 	| path -> path
-	
+
 let type_path ctx path =
 	let pack, name = real_path path in
 	HMPath (pack,name)
@@ -304,7 +304,7 @@ let property ctx p t =
 		(try
 			let f = PMap.find p c.cl_fields in
 			ident p, Some (classify ctx (apply_params c.cl_types params f.cf_type)), false
-		with Not_found -> 
+		with Not_found ->
 			ident p, None, false)
 	| _ ->
 		ident p, None, false
@@ -424,7 +424,7 @@ let gen_local_access ctx name p (forset : 'a)  : 'a access =
 		if is_set forset then write ctx (HFindProp p);
 		VGlobal p
 
-let get_local_register ctx name = 
+let get_local_register ctx name =
 	match (try PMap.find name ctx.locals with Not_found -> LScope 0) with
 	| LReg r -> Some r
 	| _ -> None
@@ -540,7 +540,7 @@ let end_fun ctx args tret =
 		| None -> HVNone
 		| Some c ->
 			match c with
-			| TInt i -> 
+			| TInt i ->
 				(match classify ctx t with
 				| KUInt -> HVUInt i
 				| _ -> HVInt i)
@@ -753,7 +753,7 @@ let gen_access ctx e (forset : 'a) : 'a access =
 		| _ -> gen_expr ctx true e1);
 		(match k with
 		| Some t -> VCast (id,t)
-		| None -> 
+		| None ->
 		match follow e1.etype, follow e.etype with
 		| _ , TFun _ when not ctx.for_call -> VCast(id,classify ctx e.etype)
 		| TEnum _, _ -> VId id
@@ -788,13 +788,13 @@ let gen_expr_twice ctx e =
 		| Some r ->
 			write ctx (HReg r.rid);
 			write ctx (HReg r.rid);
-		| None -> 
+		| None ->
 			gen_expr ctx true e;
 			write ctx HDup)
 	| TConst _ ->
 		gen_expr ctx true e;
 		gen_expr ctx true e;
-	| _ ->		
+	| _ ->
 		gen_expr ctx true e;
 		write ctx HDup
 
@@ -925,7 +925,7 @@ let rec gen_expr_content ctx retval e =
 		write ctx (HArray 0)
 	| TNew (c,tl,pl) ->
 		let id = type_id ctx (TInst (c,tl)) in
-		(match id with 
+		(match id with
 		| HMParams _ ->
 			gen_type ctx id;
 			List.iter (gen_expr ctx true) pl;
@@ -1074,7 +1074,7 @@ let rec gen_expr_content ctx retval e =
 		let t = classify ctx e.etype in
 		(try
 			let t0 = classify ctx e0.etype in
-			(* generate optimized int switch *)			
+			(* generate optimized int switch *)
 			if t0 <> KInt && t0 <> KUInt then raise Exit;
 			let rec get_int e =
 				match e.eexpr with
@@ -1398,8 +1398,8 @@ and gen_unop ctx retval op flag e =
 		let acc_read, acc_write = gen_access_rw ctx e in
 		let op = (match k, incr with
 			| KInt, true -> A3OIIncr
-			| KInt, false -> A3OIDecr 
-			| _ , true -> A3OIncr 
+			| KInt, false -> A3OIDecr
+			| _ , true -> A3OIncr
 			| _ , false -> A3ODecr
 		) in
 		getvar ctx acc_read;
@@ -1417,7 +1417,7 @@ and gen_unop ctx retval op flag e =
 			setvar ctx acc_write (if retval then Some k else None)
 
 and gen_binop ctx retval op e1 e2 t =
-	let write_op op =		
+	let write_op op =
 		let iop = (match op with
 			| OpAdd -> Some A3OIAdd
 			| OpSub -> Some A3OISub
@@ -1746,7 +1746,7 @@ let generate_class ctx c =
 		| None -> acc
 		| Some k ->
 			{
-				hlf_name = ident f.cf_name;
+				hlf_name = if c.cl_interface then HMName (f.cf_name, HNNamespace (match c.cl_path with [],n -> n | l,n -> String.concat ":" (l@[n]))) else ident f.cf_name;
 				hlf_slot = 0;
 				hlf_kind = k;
 				hlf_metas = None;
@@ -1931,7 +1931,7 @@ let generate_type ctx t =
 			let hlc = generate_enum ctx e in
 			let init = begin_fun ctx [] t_void [ethis] false e.e_pos in
 			generate_enum_init ctx e hlc;
-			write ctx HRetVoid;			
+			write ctx HRetVoid;
 			Some (init(), {
 				hlf_name = type_path ctx e.e_path;
 				hlf_slot = 0;
@@ -1960,7 +1960,7 @@ let generate com =
 		try_scope_reg = None;
 		for_call = false;
 	} in
-	let classes = List.fold_left (fun acc t -> 
+	let classes = List.fold_left (fun acc t ->
 		match generate_type ctx t with
 		| None -> acc
 		| Some (m,f) -> (t,m,f) :: acc