2
0
Эх сурвалжийг харах

revert ObjectMap constraints

Simon Krajewski 12 жил өмнө
parent
commit
f461b3bd0a

+ 2 - 2
std/Map.hx

@@ -79,7 +79,7 @@ abstract Map<K,V>(IMap<K,V> ) {
 		1. the map has no mapping for `key`
 		2. the map has a mapping with a value of `null`
 		
-		If it is important to distinguish these cases, `exists()` should be
+		If it is important to distinguish these cases, `exists()` should be 
 		used.
 		
 		If `key` is null, the result is unspecified.
@@ -145,7 +145,7 @@ abstract Map<K,V>(IMap<K,V> ) {
 		return new EnumValueMap<K, V>();
 	}
 
-	@:to static inline function toObjectMap<K:haxe.Constraints.ObjectMapKey>(t:IMap<K,V>):ObjectMap<K,V> {
+	@:to static inline function toObjectMap<K:{ }>(t:IMap<K,V>):ObjectMap<K,V> {
 		return new ObjectMap<K, V>();
 	}
 	

+ 1 - 1
std/cpp/_std/haxe/ds/ObjectMap.hx

@@ -22,7 +22,7 @@
 package haxe.ds;
 
 @:coreApi
-class ObjectMap<K:haxe.Constraints.ObjectMapKey,V> implements Map.IMap<K,V> {
+class ObjectMap<K:{},V> implements Map.IMap<K,V> {
 	private var __Internal : IntMap<V>;
 	private var __KeyRefs : IntMap<K>;
 

+ 1 - 1
std/cs/_std/haxe/ds/ObjectMap.hx

@@ -23,7 +23,7 @@ package haxe.ds;
 
 import cs.NativeArray;
 
-@:coreApi class ObjectMap<K:haxe.Constraints.ObjectMapKey, V> implements Map.IMap<K,V>
+@:coreApi class ObjectMap<K:{}, V> implements Map.IMap<K,V>
 {
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var FLAG_EMPTY = 0;

+ 1 - 3
std/flash/_std/haxe/ds/ObjectMap.hx

@@ -1,9 +1,7 @@
 package haxe.ds;
 
-import haxe.Constraints;
-
 @:coreApi
-class ObjectMap<K:ObjectMapKey,V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
+class ObjectMap<K:{},V> extends flash.utils.Dictionary implements Map.IMap<K,V> {
 
 	public function new() {
 		super(false);

+ 3 - 5
std/flash8/_std/haxe/ds/ObjectMap.hx

@@ -22,18 +22,16 @@
 
 package haxe.ds;
 
-import haxe.Constraints;
-
 @:coreApi
-class ObjectMap <K:ObjectMapKey, V> implements Map.IMap<K,V> {
+class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
 	
 	static var count = 0;
 	
-	static inline function assignId(obj:ObjectMapKey):Int {
+	static inline function assignId(obj: { } ):Int {
 		return untyped obj.__id__ = ++count;
 	}
 	
-	static inline function getId(obj:ObjectMapKey):Int {
+	static inline function getId(obj: { } ):Int {
 		return untyped obj.__id__;
 	}
 	

+ 1 - 14
std/haxe/Constraints.hx

@@ -37,17 +37,4 @@ abstract Function(Dynamic) { }
 	It is intended to be used as a type parameter constraint. If used as a real
 	type, the underlying type will be `Dynamic`.
 **/
-abstract FlatEnum(Dynamic) { }
-
-/**
-	This type is compatible with both its type parameters.
-	
-	It is intended to be used as a type parameter constraint. If used as a real
-	type, the underlying type will be `Dynamic`.
-**/
-abstract Or<L,R>(Dynamic) from L to L from R to R { }
-
-/**
-	The types allowed as key to `haxe.ds.ObjectMap`.
-**/
-extern typedef ObjectMapKey = Or<Class<Dynamic>, {}>;
+abstract FlatEnum(Dynamic) { }

+ 7 - 7
std/haxe/ds/ObjectMap.hx

@@ -30,7 +30,7 @@ package haxe.ds;
 	
 	See `Map` for documentation details.
 **/
-extern class ObjectMap<K:haxe.Constraints.ObjectMapKey, V> implements Map.IMap<K,V> {
+extern class ObjectMap < K: { }, V > implements Map.IMap<K,V> {
 	
 	/**
 		Creates a new ObjectMap.
@@ -44,31 +44,31 @@ extern class ObjectMap<K:haxe.Constraints.ObjectMapKey, V> implements Map.IMap<K
 	
 	/**
 		See `Map.get`
-	**/
+	**/	
 	public function get(key:K):Null<V>;
 	
 	/**
 		See `Map.exists`
-	**/
+	**/	
 	public function exists(key:K):Bool;
 	
 	/**
 		See `Map.remove`
-	**/
+	**/	
 	public function remove(key:K):Bool;
 	
 	/**
 		See `Map.keys`
-	**/
+	**/	
 	public function keys():Iterator<K>;
 	
 	/**
 		See `Map.iterator`
-	**/
+	**/	
 	public function iterator():Iterator<V>;
 	
 	/**
 		See `Map.toString`
-	**/
+	**/	
 	public function toString():String;
 }

+ 1 - 1
std/java/_std/haxe/ds/ObjectMap.hx

@@ -23,7 +23,7 @@ package haxe.ds;
 
 import java.NativeArray;
 
-@:coreApi class ObjectMap<K:haxe.Constraints.ObjectMapKey, V> implements Map.IMap<K,V>
+@:coreApi class ObjectMap<K:{}, V> implements Map.IMap<K,V>
 {
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var FLAG_EMPTY = 0;

+ 3 - 5
std/js/_std/haxe/ds/ObjectMap.hx

@@ -22,18 +22,16 @@
 
 package haxe.ds;
 
-import haxe.Constraints;
-
 @:coreApi
-class ObjectMap<K:ObjectMapKey, V> implements Map.IMap<K,V> {
+class ObjectMap<K:{ }, V> implements Map.IMap<K,V> {
 	
 	static var count = 0;
 	
-	static inline function assignId(obj:ObjectMapKey):Int {
+	static inline function assignId(obj: { } ):Int {
 		return untyped obj.__id__ = ++count;
 	}
 	
-	static inline function getId(obj:ObjectMapKey):Int {
+	static inline function getId(obj: { } ):Int {
 		return untyped obj.__id__;
 	}
 	

+ 3 - 5
std/neko/_std/haxe/ds/ObjectMap.hx

@@ -21,20 +21,18 @@
  */
 package haxe.ds;
 
-import haxe.Constraints;
-
 @:coreApi
-class ObjectMap<K:ObjectMapKey,V> implements Map.IMap<K,V> {
+class ObjectMap<K:{},V> implements Map.IMap<K,V> {
 
 	static var count = 0;
 	
-	static inline function assignId(obj:ObjectMapKey):Int {
+	static inline function assignId(obj: { } ):Int {
 		var newId = count++;
 		untyped obj.__id__ = newId;
 		return newId;
 	}
 	
-	static inline function getId(obj:ObjectMapKey):Int {
+	static inline function getId(obj: { } ):Int {
 		return untyped obj.__id__;
 	}
 	

+ 2 - 4
std/php/_std/haxe/ds/ObjectMap.hx

@@ -22,11 +22,9 @@
 
 package haxe.ds;
 
-import haxe.Constraints;
-
 @:coreApi
-class ObjectMap <K:ObjectMapKey, V> implements Map.IMap<K,V> {
-	static function getId(key:ObjectMapKey):String {
+class ObjectMap <K:{ }, V> implements Map.IMap<K,V> {
+	static function getId(key: { } ):String {
 		return untyped __php__("spl_object_hash($key)");
 	}