瀏覽代碼

changed syntax order for abstract this type and type parameters (fixed issue #1443)

Simon Krajewski 12 年之前
父節點
當前提交
7d52ac397f

+ 1 - 1
parser.ml

@@ -243,7 +243,7 @@ and parse_type_decl s =
 				d_flags = List.map snd c;
 				d_data = t;
 			}, punion p1 p2)
-		| [< '(Kwd Abstract,p1); doc = get_doc; name = type_name; st = parse_abstract_subtype; tl = parse_constraint_params; sl = plist parse_abstract_relations; '(BrOpen,_); fl, p2 = parse_class_fields false p1 >] ->
+		| [< '(Kwd Abstract,p1); doc = get_doc; name = type_name; tl = parse_constraint_params; st = parse_abstract_subtype; sl = plist parse_abstract_relations; '(BrOpen,_); fl, p2 = parse_class_fields false p1 >] ->
 			let flags = List.map (fun (_,c) -> match c with EPrivate -> APrivAbstract | EExtern -> error (Custom "extern abstract not allowed") p1) c in
 			let flags = (match st with None -> flags | Some t -> AIsType t :: flags) in
 			(EAbstract {

+ 1 - 1
std/Map.hx

@@ -21,7 +21,7 @@
  */
 
 @:multiType
-abstract Map(IMap < K, V > )<K,V> {
+abstract Map<K,V>(IMap < K, V > ) {
 	public function new();
 
 	@:to static inline function toHash(t:IMap < String, V > ):haxe.ds.StringMap<V> {

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

@@ -1,7 +1,7 @@
 package haxe.ds;
 
 @:coreApi
-abstract ObjectMap(flash.utils.Dictionary)<K, V> {
+abstract ObjectMap<K, V>(flash.utils.Dictionary) {
 	public inline function new(weakKeys : Bool = false) {
 		this = new flash.utils.Dictionary(weakKeys);
 	}

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

@@ -23,7 +23,7 @@
 package haxe.ds;
 
 @:coreApi
-abstract ObjectMap({}) < K: { }, V > {
+abstract ObjectMap <K:{ }, V> ({}){
 	
 	static var count = 0;
 	

+ 1 - 1
std/haxe/EnumFlags.hx

@@ -31,7 +31,7 @@ package haxe;
 	enum instance is passed directly, e.g. as has(EnumCtor). Otherwise
 	Type.enumIndex() reflection is used.
 **/
-abstract EnumFlags(Int)<T:EnumValue> {
+abstract EnumFlags<T:EnumValue>(Int) {
 
 	/**
 		Initializes the bitflags to [i].

+ 1 - 1
std/haxe/ds/HashMap.hx

@@ -21,7 +21,7 @@
  */
 package haxe.ds;
 
-abstract HashMap(IntMap<V>)<K:{ function hashCode():Int; }, V > {
+abstract HashMap<K:{ function hashCode():Int; }, V >(IntMap<V>) {
 	public function new() this = new IntMap()
 	public inline function set(k:K, v:V) this.set(k.hashCode(), v)
 	public inline function get(k:K) return this.get(k.hashCode())

+ 1 - 1
std/haxe/ds/Vector.hx

@@ -34,7 +34,7 @@ private typedef VectorData<T> = #if flash10
 	targets, and is never slower.
 **/
 @:arrayAccess
-abstract Vector(VectorData<T>)<T> {
+abstract Vector<T>(VectorData<T>) {
 	/**
 		Creates a new Vector of length [length].
 

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

@@ -23,7 +23,7 @@
 package haxe.ds;
 
 @:coreApi
-abstract ObjectMap({}) < K: { }, V > {
+abstract ObjectMap <K:{ }, V>({}){
 	
 	static var count = 0;
 	

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

@@ -22,7 +22,7 @@
 package haxe.ds;
 
 @:coreApi
-abstract ObjectMap({})<K,V> {
+abstract ObjectMap<K,V>({}) {
 
 	public function new(weakKeys:Bool = false) : Void {
 		this = untyped __dollar__hnew(0);

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

@@ -23,7 +23,7 @@
 package haxe.ds;
 
 @:coreApi
-abstract ObjectMap(StringMap<V>) < K: { }, V > {
+abstract ObjectMap <K:{ }, V>(StringMap<V>) {
 	static function getId(key: { } ) {
 		return untyped __php__("spl_object_hash($key)");
 	}

+ 2 - 2
tests/unit/MyAbstract.hx

@@ -55,7 +55,7 @@ abstract Kilometer(Float) from Float to Float {
 		return new Kilometer(m.get() / 1000.)
 }
 
-abstract MyHash(haxe.ds.StringMap<V>)<V> {
+abstract MyHash<V>(haxe.ds.StringMap<V>) {
 	private inline function new() {
 		this = new haxe.ds.StringMap<V>();
 	}
@@ -96,7 +96,7 @@ class AbstractBase<T> {
 	}
 }
 
-abstract AbstractZ(AbstractBase<T>)<T> from AbstractBase<T> {
+abstract AbstractZ<T>(AbstractBase<T>) from AbstractBase<T> {
 	@:to public static function toFoo(a:AbstractBase<Int>):Int {
 		return a.value;
 	}