Forráskód Böngészése

optimized "remove" by using __in__ instead of hasOwnProperty

Nicolas Cannasse 11 éve
szülő
commit
22cd6d4439

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

@@ -42,7 +42,7 @@ package haxe.ds;
 	}
 
 	public function remove( key : Int ) : Bool {
-		if( untyped !h.hasOwnProperty(key) ) return false;
+		if( !exists(key) ) return false;
 		untyped __delete__(h,key);
 		return true;
 	}

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

@@ -43,7 +43,7 @@ package haxe.ds;
 
 	public function remove( key : String ) : Bool {
 		key = "$"+key;
-		if( untyped !h.hasOwnProperty(key) ) return false;
+		if( untyped !__in__(key,h) ) return false;
 		untyped __delete__(h,key);
 		return true;
 	}