Browse Source

Use hasOwnProperty in IntHash rather than checking for nulls.

If an IntHash has nulls in it (untyped), hasOwnProperty is more correct, and
matches the behavior of Flash.
Bruno Garcia 13 years ago
parent
commit
ae2cf7c417
1 changed files with 2 additions and 2 deletions
  1. 2 2
      std/js/_std/IntHash.hx

+ 2 - 2
std/js/_std/IntHash.hx

@@ -40,11 +40,11 @@
 	}
 	}
 
 
 	public function exists( key : Int ) : Bool {
 	public function exists( key : Int ) : Bool {
-		return untyped h[key] != null;
+		return untyped h.hasOwnProperty(key);
 	}
 	}
 
 
 	public function remove( key : Int ) : Bool {
 	public function remove( key : Int ) : Bool {
-		if( untyped h[key] == null ) return false;
+		if( untyped !h.hasOwnProperty(key) ) return false;
 		untyped  __js__("delete")(h[key]);
 		untyped  __js__("delete")(h[key]);
 		return true;
 		return true;
 	}
 	}