浏览代码

[php7] faster StringMap.get(), IntMap.get()

Alexander Kuzmenko 8 年之前
父节点
当前提交
51d2f123e1
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      std/php7/Web.hx
  2. 1 1
      std/php7/_std/haxe/ds/IntMap.hx
  3. 1 1
      std/php7/_std/haxe/ds/StringMap.hx

+ 1 - 1
std/php7/Web.hx

@@ -224,7 +224,7 @@ class Web {
 					key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', key))));
 					_clientHeaders[key] = Std.string(value);
 				}
-			} else if(isset(copyServer[key])) {
+			} else if(copyServer[key] != null) {
 				_clientHeaders[copyServer[key]] = Std.string(value);
 			}
 		});

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

@@ -48,7 +48,7 @@ import php.NativeIndexedArray;
 		See `Map.get`
 	**/
 	public inline function get( key : Int ) : Null<T> {
-		return Global.isset(data[key]) ? data[key] : null;
+		return Syntax.binop(data[key], '??', null);
 	}
 
 	/**

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

@@ -39,7 +39,7 @@ import haxe.Constraints;
 	}
 
 	public inline function get( key : String ) : Null<T> {
-		return Global.isset(data[key]) ? data[key] : null;
+		return Syntax.binop(data[key], '??', null);
 	}
 
 	public inline function exists( key : String ) : Bool {