Browse Source

fixed flash6 enum parametrized constructors.

Nicolas Cannasse 18 years ago
parent
commit
441b4e637f
2 changed files with 10 additions and 2 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 9 2
      genswf8.ml

+ 1 - 0
doc/CHANGES.txt

@@ -18,6 +18,7 @@
 	added haxelib "dev" mode
 	renamed Http.asyncRequest to customRequest
 	add classes to Neko module export table
+	fixed parametrized enums for Flash6
 
 2007-03-06: 1.12
 	added flash lite support with -D flash_lite

+ 9 - 2
genswf8.ml

@@ -1062,10 +1062,17 @@ let gen_enum_field ctx e f =
 	| TFun (args,r) ->
 		ctx.regs <- PMap.empty;
 		ctx.reg_count <- 1;
-		let rargs = List.map (fun _ -> alloc_reg ctx , "") args in
+		let no_reg = ctx.version = 6 in
+		let rargs = List.map (fun (n,_,_) -> if no_reg then 0, n else alloc_reg ctx , "") args in
 		let nregs = List.length rargs + 1 in
 		let tf = func ctx false false rargs in
-		push ctx (List.map (fun (r,_) -> VReg r) (List.rev rargs));
+		List.iter (fun (r,name) -> 
+			if no_reg then begin
+				push ctx [VStr (name,false)];
+				write ctx AEval;
+			end else
+				push ctx [VReg r]
+		) (List.rev rargs);
 		push ctx [VStr (f.ef_name,false); VInt nregs];
 		write ctx AInitArray;
 		write ctx ADup;