|
@@ -27,25 +27,25 @@ import python.lib.Functools;
|
|
@:allow(Array)
|
|
@:allow(Array)
|
|
class ArrayImpl {
|
|
class ArrayImpl {
|
|
|
|
|
|
- @:ifFeature("dynamic_read.length", "anon_optional_read.length")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.length", "anon_optional_read.length", "python.internal.ArrayImpl.length")
|
|
public static inline function get_length <T>(x:Array<T>):Int return UBuiltins.len(x);
|
|
public static inline function get_length <T>(x:Array<T>):Int return UBuiltins.len(x);
|
|
|
|
|
|
- @:ifFeature("dynamic_read.concat", "anon_optional_read.concat")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.concat", "anon_optional_read.concat", "python.internal.ArrayImpl.concat")
|
|
public static inline function concat<T>(a1:Array<T>, a2 : Array<T>) : Array<T> {
|
|
public static inline function concat<T>(a1:Array<T>, a2 : Array<T>) : Array<T> {
|
|
return Syntax.binop(a1, "+", a2);
|
|
return Syntax.binop(a1, "+", a2);
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.copy", "anon_optional_read.copy")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.copy", "anon_optional_read.copy", "python.internal.ArrayImpl.copy")
|
|
public static inline function copy<T>(x:Array<T>) : Array<T> {
|
|
public static inline function copy<T>(x:Array<T>) : Array<T> {
|
|
return UBuiltins.list(x);
|
|
return UBuiltins.list(x);
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.iterator", "anon_optional_read.iterator")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.iterator", "anon_optional_read.iterator", "python.internal.ArrayImpl.iterator")
|
|
public static inline function iterator<T>(x:Array<T>) : Iterator<T> {
|
|
public static inline function iterator<T>(x:Array<T>) : Iterator<T> {
|
|
return new HaxeIterator(Syntax.callField(x, "__iter__"));
|
|
return new HaxeIterator(Syntax.callField(x, "__iter__"));
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.indexOf", "anon_optional_read.indexOf")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.indexOf", "anon_optional_read.indexOf", "python.internal.ArrayImpl.indexOf")
|
|
public static function indexOf<T>(a:Array<T>, x : T, ?fromIndex:Int) : Int {
|
|
public static function indexOf<T>(a:Array<T>, x : T, ?fromIndex:Int) : Int {
|
|
var len = a.length;
|
|
var len = a.length;
|
|
var l =
|
|
var l =
|
|
@@ -59,7 +59,7 @@ class ArrayImpl {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.lastIndexOf", "anon_optional_read.lastIndexOf")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.lastIndexOf", "anon_optional_read.lastIndexOf", "python.internal.ArrayImpl.lastIndexOf")
|
|
public static function lastIndexOf<T>(a:Array<T>, x : T, ?fromIndex:Int) : Int {
|
|
public static function lastIndexOf<T>(a:Array<T>, x : T, ?fromIndex:Int) : Int {
|
|
var len = a.length;
|
|
var len = a.length;
|
|
var l =
|
|
var l =
|
|
@@ -74,33 +74,33 @@ class ArrayImpl {
|
|
}
|
|
}
|
|
|
|
|
|
@:access(python.Boot)
|
|
@:access(python.Boot)
|
|
- @:ifFeature("dynamic_read.join", "anon_optional_read.join")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.join", "anon_optional_read.join", "python.internal.ArrayImpl.join")
|
|
public static inline function join<T>(x:Array<T>, sep : String ) : String {
|
|
public static inline function join<T>(x:Array<T>, sep : String ) : String {
|
|
return Boot.arrayJoin(x, sep);
|
|
return Boot.arrayJoin(x, sep);
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.toString", "anon_optional_read.toString")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.toString", "anon_optional_read.toString", "python.internal.ArrayImpl.toString")
|
|
public static inline function toString<T>(x:Array<T>) : String {
|
|
public static inline function toString<T>(x:Array<T>) : String {
|
|
return "[" + join(x, ",") + "]";
|
|
return "[" + join(x, ",") + "]";
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.pop", "anon_optional_read.pop")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.pop", "anon_optional_read.pop", "python.internal.ArrayImpl.pop")
|
|
public static inline function pop<T>(x:Array<T>) : Null<T> {
|
|
public static inline function pop<T>(x:Array<T>) : Null<T> {
|
|
return if (x.length == 0) null else Syntax.callField(x, "pop");
|
|
return if (x.length == 0) null else Syntax.callField(x, "pop");
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.push", "anon_optional_read.push")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.push", "anon_optional_read.push", "python.internal.ArrayImpl.push")
|
|
public static inline function push<T>(x:Array<T>, e:T) : Int {
|
|
public static inline function push<T>(x:Array<T>, e:T) : Int {
|
|
Syntax.callField(x, "append", e);
|
|
Syntax.callField(x, "append", e);
|
|
return x.length;
|
|
return x.length;
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.unshift", "anon_optional_read.unshift")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.unshift", "anon_optional_read.unshift", "python.internal.ArrayImpl.unshift")
|
|
public static inline function unshift<T>(x:Array<T>,e : T) : Void {
|
|
public static inline function unshift<T>(x:Array<T>,e : T) : Void {
|
|
x.insert(0,e);
|
|
x.insert(0,e);
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.remove", "anon_optional_read.remove")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.remove", "anon_optional_read.remove", "python.internal.ArrayImpl.remove")
|
|
public static function remove<T>(x:Array<T>,e : T) : Bool {
|
|
public static function remove<T>(x:Array<T>,e : T) : Bool {
|
|
try {
|
|
try {
|
|
Syntax.callField(x, "remove", e);
|
|
Syntax.callField(x, "remove", e);
|
|
@@ -110,22 +110,22 @@ class ArrayImpl {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.shift", "anon_optional_read.shift")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.shift", "anon_optional_read.shift", "python.internal.ArrayImpl.shift")
|
|
public static inline function shift<T>(x:Array<T>) : Null<T> {
|
|
public static inline function shift<T>(x:Array<T>) : Null<T> {
|
|
if (x.length == 0) return null;
|
|
if (x.length == 0) return null;
|
|
return Syntax.callField(x, "pop", 0);
|
|
return Syntax.callField(x, "pop", 0);
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.slice", "anon_optional_read.slice")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.slice", "anon_optional_read.slice", "python.internal.ArrayImpl.slice")
|
|
public static inline function slice<T>(x:Array<T>, pos : Int, ?end : Int ) : Array<T> {
|
|
public static inline function slice<T>(x:Array<T>, pos : Int, ?end : Int ) : Array<T> {
|
|
return Syntax.arrayAccess(x, pos, end);
|
|
return Syntax.arrayAccess(x, pos, end);
|
|
}
|
|
}
|
|
- @:ifFeature("dynamic_read.sort", "anon_optional_read.sort")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.sort", "anon_optional_read.sort", "python.internal.ArrayImpl.sort")
|
|
public static inline function sort<T>(x:Array<T>, f:T->T->Int) : Void {
|
|
public static inline function sort<T>(x:Array<T>, f:T->T->Int) : Void {
|
|
Syntax.callNamedUntyped(Syntax.field(x, "sort"), { key : Functools.cmp_to_key(f) });
|
|
Syntax.callNamedUntyped(Syntax.field(x, "sort"), { key : Functools.cmp_to_key(f) });
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.splice", "anon_optional_read.splice")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.splice", "anon_optional_read.splice", "python.internal.ArrayImpl.splice")
|
|
public static inline function splice<T>(x:Array<T>, pos : Int, len : Int ) : Array<T> {
|
|
public static inline function splice<T>(x:Array<T>, pos : Int, len : Int ) : Array<T> {
|
|
if (pos < 0) pos = x.length+pos;
|
|
if (pos < 0) pos = x.length+pos;
|
|
if (pos < 0) pos = 0;
|
|
if (pos < 0) pos = 0;
|
|
@@ -134,21 +134,21 @@ class ArrayImpl {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.map", "anon_optional_read.map")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.map", "anon_optional_read.map", "python.internal.ArrayImpl.map")
|
|
public static inline function map<S,T>(x:Array<T>, f : T -> S) : Array<S> {
|
|
public static inline function map<S,T>(x:Array<T>, f : T -> S) : Array<S> {
|
|
return UBuiltins.list(UBuiltins.map(f, cast x));
|
|
return UBuiltins.list(UBuiltins.map(f, cast x));
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.filter", "anon_optional_read.filter")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.filter", "anon_optional_read.filter", "python.internal.ArrayImpl.filter")
|
|
public static inline function filter<T>(x:Array<T>, f : T -> Bool) : Array<T> {
|
|
public static inline function filter<T>(x:Array<T>, f : T -> Bool) : Array<T> {
|
|
return UBuiltins.list(UBuiltins.filter(f, cast x));
|
|
return UBuiltins.list(UBuiltins.filter(f, cast x));
|
|
}
|
|
}
|
|
|
|
|
|
- @:ifFeature("dynamic_read.insert", "anon_optional_read.insert")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.insert", "anon_optional_read.insert", "python.internal.ArrayImpl.insert")
|
|
public static inline function insert<T>(a:Array<T>, pos : Int, x : T ) : Void {
|
|
public static inline function insert<T>(a:Array<T>, pos : Int, x : T ) : Void {
|
|
Syntax.callField(a, "insert", pos, x);
|
|
Syntax.callField(a, "insert", pos, x);
|
|
}
|
|
}
|
|
- @:ifFeature("dynamic_read.reverse", "anon_optional_read.reverse")
|
|
|
|
|
|
+ @:ifFeature("dynamic_read.reverse", "anon_optional_read.reverse", "python.internal.ArrayImpl.reverse")
|
|
public static inline function reverse<T>(a:Array<T>) : Void {
|
|
public static inline function reverse<T>(a:Array<T>) : Void {
|
|
Syntax.callField(a, "reverse");
|
|
Syntax.callField(a, "reverse");
|
|
}
|
|
}
|