浏览代码

fixed Type.typeof(1<<28) was TFloat

Nicolas Cannasse 15 年之前
父节点
当前提交
3cea253d65
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 0
      doc/CHANGES.txt
  2. 5 1
      std/Type.hx

+ 1 - 0
doc/CHANGES.txt

@@ -25,6 +25,7 @@
 	all : some completion related errors fixed
 	flash9 : added @:bind support
 	all : fixed StringTools.hex with negative numbers
+	flash9 : fixed Type.typeof(1<<28) was TFloat
 
 2010-01-09: 2.05
 	js : added js.Scroll

+ 5 - 1
std/Type.hx

@@ -608,7 +608,11 @@ class Type {
 			case "null": return TNull;
 			case "void": return TNull; // undefined
 			case "int": return TInt;
-			case "Number": return TFloat;
+			case "Number":
+				// integers >28 bits are stored as Numbers in avm2
+				if( (v < -0x10000000 || v >= 0x10000000) && Std.int(v) == v )
+					return TInt;
+				return TFloat;
 			case "Boolean": return TBool;
 			case "Object": return TObject;
 			case "Function": return TFunction;