Selaa lähdekoodia

allow `@:op([])` instead of `@:arrayAccess` and use it on haxe.ds.Vector to test (see #4275)

Simon Krajewski 10 vuotta sitten
vanhempi
commit
644fa9626b
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 2 2
      std/haxe/ds/Vector.hx
  2. 1 1
      typeload.ml

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

@@ -81,7 +81,7 @@ abstract Vector<T>(VectorData<T>) {
 		If `index` is negative or exceeds `this.length`, the result is
 		unspecified.
 	**/
-	@:arrayAccess public inline function get(index:Int):T {
+	@:op([]) public inline function get(index:Int):T {
 		#if cpp
 		return this.unsafeGet(index);
 		#elseif python
@@ -97,7 +97,7 @@ abstract Vector<T>(VectorData<T>) {
 		If `index` is negative or exceeds `this.length`, the result is
 		unspecified.
 	**/
-	@:arrayAccess public inline function set(index:Int, val:T):T {
+	@:op([]) public inline function set(index:Int, val:T):T {
 		#if cpp
 		return this.unsafeSet(index,val);
 		#elseif python

+ 1 - 1
typeload.ml

@@ -2340,7 +2340,7 @@ let init_class ctx c p context_init herits fields =
 							) "@:to" in
 							delay ctx PForce (fun() -> ignore ((!r)()));
 							a.a_to_field <- (TLazy r, cf) :: a.a_to_field
-						| (Meta.ArrayAccess,_,_) :: _ ->
+						| ((Meta.ArrayAccess,_,_) | (Meta.Op,[(EArrayDecl _),_],_)) :: _ ->
 							if is_macro then error (f.cff_name ^ ": Macro array-access functions are not supported") p;
 							a.a_array <- cf :: a.a_array;
 							if Meta.has Meta.CoreType a.a_meta then check_bind();