Przeglądaj źródła

get rid of python.Choice

frabbit 11 lat temu
rodzic
commit
c340d7173e
3 zmienionych plików z 7 dodań i 10 usunięć
  1. 0 6
      std/python/Choice.hx
  2. 2 4
      std/python/lib/Builtin.hx
  3. 5 0
      std/python/lib/Re.hx

+ 0 - 6
std/python/Choice.hx

@@ -1,6 +0,0 @@
-package python;
-
-abstract Choice <A,B>(Dynamic) {
-	@:from public static inline function fromA <A,B>(x:A):Choice<A,B> return cast x;
-	@:from public static inline function fromB <A,B>(x:B):Choice<A,B> return cast x;
-}

+ 2 - 4
std/python/lib/Builtin.hx

@@ -6,9 +6,6 @@ import python.lib.io.IOBase;
 import python.lib.Dict;
 import python.NativeIterable;
 import python.NativeIterator;
-import python.Choice;
-
-
 
 @:native("_hx_builtin")
 extern class Builtin {
@@ -96,7 +93,8 @@ extern class Builtin {
 	@:overload(function <G>(f:Tuple<G>):Array<G> {})
 	public static function list<T>(i:NativeIterable<T>):Array<T>;
 
-	public static function filter<A>(f:A->Bool, i:Choice<Array<A>, NativeIterable<A>>):NativeIterator<A>;
+	@:overload(function <A>(f:A->Bool, i:NativeIterable<A>):NativeIterator<A> {})
+	public static function filter<A>(f:A->Bool, i:Array<A>):NativeIterator<A>;
 	//public static function raw_input():Void;
 	//public static function unichr():Void;
 

+ 5 - 0
std/python/lib/Re.hx

@@ -4,6 +4,11 @@ package python.lib;
 import python.lib.Tuple;
 
 
+private abstract Choice <A,B>(Dynamic) {
+	@:from public static inline function fromA <A,B>(x:A):Choice<A,B> return cast x;
+	@:from public static inline function fromB <A,B>(x:B):Choice<A,B> return cast x;
+}
+
 typedef TODO = Dynamic;
 
 typedef Pattern = Choice<String, Regex>;