Nicolas Cannasse 16 年之前
父节点
当前提交
a7a96a0dfd
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      genswf9.ml

+ 5 - 4
genswf9.ml

@@ -1058,10 +1058,11 @@ let rec gen_expr_content ctx retval e =
 		ctx.continues <- (fun target -> DynArray.set ctx.code op (HJump (J3Always,target - p))) :: ctx.continues;
 		no_value ctx retval
 	| TSwitch (e0,el,eo) ->
-		let t = classify ctx e0.etype in
+		let t = classify ctx e.etype in
 		(try
-			(* generate optimized int switch *)
-			if t <> KInt && t <> KUInt then raise Exit;
+			let t0 = classify ctx e0.etype in
+			(* generate optimized int switch *)			
+			if t0 <> KInt && t0 <> KUInt then raise Exit;
 			let rec get_int e =
 				match e.eexpr with
 				| TConst (TInt n) -> Int32.to_int n
@@ -1073,7 +1074,7 @@ let rec gen_expr_content ctx retval e =
 				if n < 0 || n > 512 then raise Exit;
 			) vl) el;
 			gen_expr ctx true e0;
-			if t <> KInt then write ctx HToInt;
+			if t0 <> KInt then write ctx HToInt;
 			let switch, case = begin_switch ctx in
 			(match eo with
 			| None ->