Sfoglia il codice sorgente

haxe.FastList -> haxe.ds.GenericStack

Simon Krajewski 12 anni fa
parent
commit
3d509a2fbc
3 ha cambiato i file con 8 aggiunte e 8 eliminazioni
  1. 1 1
      optimizer.ml
  2. 4 4
      std/haxe/ds/GenericStack.hx
  3. 3 3
      tests/unit/TestType.hx

+ 1 - 1
optimizer.ml

@@ -527,7 +527,7 @@ let optimize_for_loop ctx i e1 e2 p =
 		gen_int_iter pt
 	| _ , TInst({ cl_array_access = Some pt } as c,pl) when (try match follow (PMap.find "length" c.cl_fields).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_fields) ->
 		gen_int_iter (apply_params c.cl_types pl pt)
-	| _ , TInst ({ cl_kind = KGenericInstance ({ cl_path = ["haxe"],"FastList" },[t]) } as c,[]) ->
+	| _ , TInst ({ cl_kind = KGenericInstance ({ cl_path = ["haxe";"ds"],"GenericStack" },[t]) } as c,[]) ->
 		let tcell = (try (PMap.find "head" c.cl_fields).cf_type with Not_found -> assert false) in
 		let i = add_local ctx i t in
 		let cell = gen_local ctx tcell in

+ 4 - 4
std/haxe/FastList.hx → std/haxe/ds/GenericStack.hx

@@ -19,7 +19,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-package haxe;
+package haxe.ds;
 
 #if (haxe3 && (flash9 || cpp))
 @:generic
@@ -34,7 +34,7 @@ class FastCell<T> #if (!haxe3 && (flash9 || cpp)) implements haxe.rtti.Generic #
 #if haxe3
 @:generic
 #end
-private class FastListIterator<T> extends cpp.FastIterator<T>#if !haxe3 , implements haxe.rtti.Generic #end {
+private class GenericStackIterator<T> extends cpp.FastIterator<T>#if !haxe3 , implements haxe.rtti.Generic #end {
 	public var current : FastCell<T>;
 	override public function hasNext():Bool { return current!=null; }
 	override public function next():T { var result = current.elt; current = current.next; return result; }
@@ -50,7 +50,7 @@ private class FastListIterator<T> extends cpp.FastIterator<T>#if !haxe3 , implem
 #if (haxe3 && (flash9 || cpp))
 @:generic
 #end
-class FastList<T> #if (!haxe3 && (flash9 || cpp)) implements haxe.rtti.Generic #end {
+class GenericStack<T> #if (!haxe3 && (flash9 || cpp)) implements haxe.rtti.Generic #end {
 
 	public var head : FastCell<T>;
 
@@ -124,7 +124,7 @@ class FastList<T> #if (!haxe3 && (flash9 || cpp)) implements haxe.rtti.Generic #
 		Returns an iterator on the elements of the list.
 	**/
 	public function iterator() : Iterator<T> {
-		return new FastListIterator<T>(head);
+		return new GenericStackIterator<T>(head);
 	}
 
 	#else

+ 3 - 3
tests/unit/TestType.hx

@@ -559,7 +559,7 @@ class TestType extends Test {
 		gf1(new haxe.Template("foo"));
 		#end
 
-		gf1(new haxe.FastList<Int>());
+		gf1(new haxe.ds.GenericStack<Int>());
 		hsf(TestType, "gf1_Int");
 		hsf(TestType, "gf1_String");
 		hsf(TestType, "gf1_Bool");
@@ -568,7 +568,7 @@ class TestType extends Test {
 		hsf(TestType, "gf1_haxe_Template");
 		#end
 
-		hsf(TestType, #if (flash9 || cpp) "gf1_haxe_FastList_Int" #else "gf1_haxe_FastList" #end);
+		hsf(TestType, #if (flash9 || cpp) "gf1_haxe_ds_GenericStack_Int" #else "gf1_haxe_ds_GenericStack" #end);
 		t(typeError(gf1(null))); // monos don't work
 		t(typeError(gf1( { foo:1 } ))); // structures don't work
 
@@ -703,7 +703,7 @@ class TestType extends Test {
 		eq(map.get(a), "foo");
 		eq(map.get(b), "bar");
 		t(Std.is(map, haxe.ds.HashMap));
-		
+
 		//var map = new unit.MyAbstract.MyMap();
 		//map.set(new haxe.Template("foo"), 99);
 		//t(Std.is(map, unit.MyAbstract.PseudoObjectHash));