2
0
Nicolas Cannasse 18 жил өмнө
parent
commit
e2b8ea69da
2 өөрчлөгдсөн 7 нэмэгдсэн , 5 устгасан
  1. 1 0
      doc/CHANGES.txt
  2. 6 5
      genswf9.ml

+ 1 - 0
doc/CHANGES.txt

@@ -10,6 +10,7 @@
 	fixed Null should not be a value
 	bugfix in serialization format with USE_ENUM_INDEXES
 	added apis in DateTools for time manipulation
+	bugfix in flash9 : strictly typed local vars used in local functions
 
 2007-10-31: 1.16
 	use _sans font for default flash traces (better Linux support)

+ 6 - 5
genswf9.ml

@@ -106,7 +106,7 @@ type context = {
 	mutable continues : (int -> unit) list;
 	mutable in_static : bool;
 	mutable curblock : texpr list;
-	mutable block_vars : (as3_slot * string) list;
+	mutable block_vars : (as3_slot * string * t) list;
 	mutable try_scope_reg : register option;
 }
 
@@ -361,11 +361,12 @@ let pop ctx n =
 let define_local ctx ?(init=false) name t el =
 	let l = (if List.exists (Transform.local_find false name) el then begin
 			let pos = (try
-				fst (List.find (fun (_,x) -> name = x) ctx.block_vars)
+				let slot , _ , _ = (List.find (fun (_,x,_) -> name = x) ctx.block_vars) in
+				slot
 			with
 				Not_found ->
 					let n = List.length ctx.block_vars + 1 in
-					ctx.block_vars <- (n,name) :: ctx.block_vars;
+					ctx.block_vars <- (n,name,t) :: ctx.block_vars;
 					n
 			) in
 			LScope pos
@@ -591,11 +592,11 @@ let begin_fun ctx args tret el stat p =
 					tc3_name = None;
 				}
 			) (List.rev ctx.trys));
-			fun3_locals = Array.of_list (List.map (fun (id,name) ->
+			fun3_locals = Array.of_list (List.map (fun (id,name,t) ->
 				{
 					f3_name = ident ctx name;
 					f3_slot = id;
-					f3_kind = A3FVar { v3_type = None; v3_value = A3VNone; v3_const = false };
+					f3_kind = A3FVar { v3_type = Some (type_id ctx t); v3_value = A3VNone; v3_const = false };
 					f3_metas = None;
 				}
 			) ctx.block_vars);