Browse Source

use __in__ instead of hasOwnProperty (faster, inlined)

Nicolas Cannasse 11 years ago
parent
commit
7ca18ab9d9
2 changed files with 4 additions and 4 deletions
  1. 2 2
      std/flash/_std/haxe/ds/IntMap.hx
  2. 2 2
      std/flash/_std/haxe/ds/StringMap.hx

+ 2 - 2
std/flash/_std/haxe/ds/IntMap.hx

@@ -37,8 +37,8 @@ package haxe.ds;
 		return untyped h[key];
 		return untyped h[key];
 	}
 	}
 
 
-	public function exists( key : Int ) : Bool {
-		return untyped h.hasOwnProperty(key);
+	public inline function exists( key : Int ) : Bool {
+		return untyped __in__(key,h);
 	}
 	}
 
 
 	public function remove( key : Int ) : Bool {
 	public function remove( key : Int ) : Bool {

+ 2 - 2
std/flash/_std/haxe/ds/StringMap.hx

@@ -37,8 +37,8 @@ package haxe.ds;
 		return untyped h["$"+key];
 		return untyped h["$"+key];
 	}
 	}
 
 
-	public function exists( key : String ) : Bool {
-		return untyped h.hasOwnProperty("$"+key);
+	public inline function exists( key : String ) : Bool {
+		return untyped __in__("$"+key,h);
 	}
 	}
 
 
 	public function remove( key : String ) : Bool {
 	public function remove( key : String ) : Bool {