2
0
Эх сурвалжийг харах

moved FastList from flash to haxe package

Nicolas Cannasse 17 жил өмнө
parent
commit
00a7d5a5dc

+ 1 - 1
doc/CHANGES.txt

@@ -2,7 +2,7 @@
 	fixed flash9 Array.toString
 	fixed inline return bug
 	added haxe.rtti.Generic behavior
-	added flash9.FastList
+	added haxe.FastList
 	TODO haxe/f9 : inline code can give bad file in debug infos
 	TODO haxe/f9 var x = if( true ) Math.POSITIVE_INFINITY : 0.; VerifyError
 

+ 7 - 7
std/flash9/FastList.hx → std/haxe/FastList.hx

@@ -22,20 +22,20 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package flash;
+package haxe;
 
-private class Cell<T> implements haxe.rtti.Generic {
+class FastCell<T> #if flash9 implements haxe.rtti.Generic #end {
 	public var elt : T;
-	public var next : Cell<T>;
+	public var next : FastCell<T>;
 	public function new(elt,next) { this.elt = elt; this.next = next; }
 }
 
 /**
-	A linked-list of elements. A different class is created for each container used.
+	A linked-list of elements. A different class is created for each container used in platforms where it matters
 **/
-class FastList<T> implements haxe.rtti.Generic {
+class FastList<T> #if flash9 implements haxe.rtti.Generic #end {
 
-	public var head : Cell<T>;
+	public var head : FastCell<T>;
 
 	/**
 		Creates a new empty list.
@@ -47,7 +47,7 @@ class FastList<T> implements haxe.rtti.Generic {
 		Add an element at the head of the list.
 	**/
 	public inline function add( item : T ) {
-		head = new Cell<T>(item,head);
+		head = new FastCell<T>(item,head);
 	}
 
 	/**

+ 1 - 2
std/haxe/ImportAll.hx

@@ -45,6 +45,7 @@ import StringTools;
 import Type;
 import Xml;
 
+import haxe.FastList;
 #if !neko
 import haxe.Firebug;
 #end
@@ -100,7 +101,6 @@ import haxe.unit.TestStatus;
 // generated by haxe
 import flash.Boot;
 import flash.Lib;
-import flash.FastList;
 import flash.FlashXml__;
 import flash.accessibility.Accessibility;
 import flash.accessibility.AccessibilityImplementation;
@@ -313,7 +313,6 @@ import flash.system.Security;
 // generated by haxe
 import flash9.Boot;
 import flash9.Lib;
-import flash9.FastList;
 import flash9.FlashXml__;
 import flash9.accessibility.Accessibility;
 import flash9.accessibility.AccessibilityImplementation;

+ 3 - 3
typer.ml

@@ -464,8 +464,8 @@ and build_generic ctx c allow p tl =
 	with Error(Module_not_found path,_) when path = (pack,name) ->
 		(* try to find the module in which the generic class was originally defined *)
 		let mpath = (if c.cl_private then match List.rev (fst c.cl_path) with [] -> assert false | x :: l -> List.rev l, String.sub x 1 (String.length x - 1) else c.cl_path) in
-		let m = try Hashtbl.find ctx.modules mpath with Not_found -> assert false in
-		let ctx = { ctx with local_types = m.mtypes @ ctx.local_types } in
+		let mtypes = try (Hashtbl.find ctx.modules mpath).mtypes with Not_found -> [] in
+		let ctx = { ctx with local_types = mtypes @ ctx.local_types } in
 		let cg = mk_class (pack,name) c.cl_pos None false in
 		let mg = {
 			mpath = cg.cl_path;
@@ -2400,7 +2400,7 @@ and optimize_for_loop ctx i e1 e2 p =
 					NormalWhile
 				)) t_void p;
 			]) t_void p
-		| TInst ({ cl_kind = KGenericInstance ({ cl_path = ["flash"],"FastList" },[t]) } as c,[]) ->
+		| TInst ({ cl_kind = KGenericInstance ({ cl_path = ["haxe"],"FastList" },[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