Prechádzať zdrojové kódy

allow suitable key types of Map to infer HashMap

Simon Krajewski 12 rokov pred
rodič
commit
d6e2192e91
1 zmenil súbory, kde vykonal 6 pridanie a 2 odobranie
  1. 6 2
      std/Map.hx

+ 6 - 2
std/Map.hx

@@ -11,13 +11,17 @@ typedef IMap < K, V > = {
 abstract Map(IMap < K, V > )<K,V> {
 	public function new();
 
-	@:to static inline public function toHash(t:IMap < String, V > ):Hash<V> {
+	@:to static inline function toHash(t:IMap < String, V > ):Hash<V> {
 		return new Hash<V>();
 	}
 
-	@:to static inline public function toIntHash(t:IMap < Int, V > ):haxe.ds.IntMap<V> {
+	@:to static inline function toIntHash(t:IMap < Int, V > ):haxe.ds.IntMap<V> {
 		return new haxe.ds.IntMap<V>();
 	}
+	
+	@:to static inline function toHashMap<K:{ function hashCode():Int; }>(t:IMap < K, V >):haxe.ds.HashMap<K,V> {
+		return new haxe.ds.HashMap<K, V>();
+	}
 
 	public inline function set(k:K, v:V) this.set(k, v)
 	public inline function get(k:K) return this.get(k)