Browse Source

fixed Std.is("123",String) for Flash8

Nicolas Cannasse 16 years ago
parent
commit
6737ce21c2
2 changed files with 4 additions and 1 deletions
  1. 1 1
      std/flash/Boot.hx
  2. 3 0
      tests/unit/TestReflect.hx

+ 1 - 1
std/flash/Boot.hx

@@ -138,7 +138,7 @@ class Boot {
 			#end
 			switch( cast cl ) {
 			case Int:
-				return __physeq__(Math.ceil(o),o%2147483648.0) && !(__physeq__(o,true) || __physeq__(o,false));
+				return __typeof__(o) == "number" && __physeq__(Math.ceil(o),o%2147483648.0) && !(__physeq__(o,true) || __physeq__(o,false));
 			case Float:
 				return __typeof__(o) == "number";
 			case Bool:

+ 3 - 0
tests/unit/TestReflect.hx

@@ -58,6 +58,7 @@ class TestReflect extends Test {
 		is(0,Int,Float);
 		is(1,Int,Float);
 		is(-1,Int,Float);
+		// unspec : is(1.0,Int,Float);
 		is(1.2,Float);
 		is(1e10,Float);
 		is(-1e10,Float);
@@ -67,6 +68,8 @@ class TestReflect extends Test {
 		is(true,Bool);
 		is(false,Bool);
 		is("Hello",String);
+		is("123",String);
+		is("false",String);
 		is("",String);
 		is([],Array);
 		is(new List(),List);