Bläddra i källkod

Move List to haxe.ds.List (#6610)

* Move List to haxe.ds.List

* Fix serializer
Kevin Leung 8 år sedan
förälder
incheckning
f0ef8c493a

+ 3 - 0
std/Lambda.hx

@@ -1,3 +1,4 @@
+import haxe.ds.List;
 /*
 /*
  * Copyright (C)2005-2017 Haxe Foundation
  * Copyright (C)2005-2017 Haxe Foundation
  *
  *
@@ -34,7 +35,9 @@
 
 
 	@see https://haxe.org/manual/std-Lambda.html
 	@see https://haxe.org/manual/std-Lambda.html
 **/
 **/
+
 class Lambda {
 class Lambda {
+	
 
 
 	/**
 	/**
 		Creates an Array from Iterable `it`.
 		Creates an Array from Iterable `it`.

+ 2 - 0
std/haxe/Http.hx

@@ -21,6 +21,8 @@
  */
  */
 package haxe;
 package haxe;
 
 
+import haxe.ds.List;
+
 #if sys
 #if sys
 
 
 import sys.net.Host;
 import sys.net.Host;

+ 2 - 1
std/haxe/Serializer.hx

@@ -21,6 +21,7 @@
  */
  */
 package haxe;
 package haxe;
 
 
+import haxe.ds.List;
 /**
 /**
 	The Serializer class can be used to encode values and objects into a `String`,
 	The Serializer class can be used to encode values and objects into a `String`,
 	from which the `Unserializer` class can recreate the original representation.
 	from which the `Unserializer` class can recreate the original representation.
@@ -288,7 +289,7 @@ class Serializer {
 					}
 					}
 				}
 				}
 				buf.add("h");
 				buf.add("h");
-			case #if (neko || cs || python) "List" #else cast List #end:
+			case #if (neko || cs || python) "haxe.ds.List" #else cast List #end:
 				buf.add("l");
 				buf.add("l");
 				var v : List<Dynamic> = v;
 				var v : List<Dynamic> = v;
 				for( i in v )
 				for( i in v )

+ 2 - 0
std/haxe/Unserializer.hx

@@ -21,6 +21,8 @@
  */
  */
 package haxe;
 package haxe;
 
 
+import haxe.ds.List;
+
 @:noDoc
 @:noDoc
 typedef TypeResolver = {
 typedef TypeResolver = {
 	function resolveClass( name : String ) : Class<Dynamic>;
 	function resolveClass( name : String ) : Class<Dynamic>;

+ 1 - 0
std/List.hx → std/haxe/ds/List.hx

@@ -19,6 +19,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
+package haxe.ds;
 
 
 /**
 /**
 	A linked-list of elements. The list is composed of element container objects
 	A linked-list of elements. The list is composed of element container objects

+ 2 - 0
std/haxe/rtti/CType.hx

@@ -21,6 +21,8 @@
  */
  */
 package haxe.rtti;
 package haxe.rtti;
 
 
+import haxe.ds.List;
+
 /**
 /**
 	The (dot-)path of the runtime type.
 	The (dot-)path of the runtime type.
 **/
 **/

+ 2 - 0
std/haxe/zip/Entry.hx

@@ -21,6 +21,8 @@
  */
  */
 package haxe.zip;
 package haxe.zip;
 
 
+import haxe.ds.List;
+
 enum ExtraField {
 enum ExtraField {
 	FUnknown( tag : Int, bytes : haxe.io.Bytes );
 	FUnknown( tag : Int, bytes : haxe.io.Bytes );
 	FInfoZipUnicodePath( name : String, crc : Int );
 	FInfoZipUnicodePath( name : String, crc : Int );

+ 1 - 0
std/haxe/zip/Reader.hx

@@ -21,6 +21,7 @@
  */
  */
 package haxe.zip;
 package haxe.zip;
 import haxe.zip.Entry;
 import haxe.zip.Entry;
+import haxe.ds.List;
 
 
 // see http://www.pkware.com/documents/casestudies/APPNOTE.TXT
 // see http://www.pkware.com/documents/casestudies/APPNOTE.TXT
 
 

+ 2 - 0
std/haxe/zip/Writer.hx

@@ -21,6 +21,8 @@
  */
  */
 package haxe.zip;
 package haxe.zip;
 
 
+import haxe.ds.List;
+
 class Writer {
 class Writer {
 
 
 	/*
 	/*

+ 2 - 0
std/neko/Web.hx

@@ -21,6 +21,8 @@
  */
  */
 package neko;
 package neko;
 
 
+import haxe.ds.List;
+
 /**
 /**
 	This class is used for accessing the local Web server and the current
 	This class is used for accessing the local Web server and the current
 	client request and information.
 	client request and information.

+ 3 - 1
tests/optimization/src/TestJs.hx

@@ -1,3 +1,5 @@
+import haxe.ds.List;
+
 private enum Tree<T> {
 private enum Tree<T> {
 	Node(l:Tree<T>, r:Tree<T>);
 	Node(l:Tree<T>, r:Tree<T>);
 	Leaf(v:T);
 	Leaf(v:T);
@@ -38,7 +40,7 @@ class TestJs {
 	//Std.string(x);
 	//Std.string(x);
 	//}
 	//}
 
 
-	@:js("var a = new List();var _g_head = a.h;while(_g_head != null) _g_head = _g_head.next;")
+	@:js("var a = new haxe_ds_List();var _g_head = a.h;while(_g_head != null) _g_head = _g_head.next;")
 	static function testListIteratorInline() {
 	static function testListIteratorInline() {
 		var a = new List();
 		var a = new List();
 		for (v in a) { }
 		for (v in a) { }

+ 1 - 1
tests/unit/compile-each.hxml

@@ -1,7 +1,7 @@
 -D source-header=''
 -D source-header=''
 -debug
 -debug
 -cp src
 -cp src
--cp "C:\Program Files\The Haxe Effect\src/dev/null"
+# -cp "C:\Program Files\The Haxe Effect\src/dev/null"
 -resource res1.txt@re/s?!%[]))("'1.txt
 -resource res1.txt@re/s?!%[]))("'1.txt
 -resource res2.bin@re/s?!%[]))("'1.bin
 -resource res2.bin@re/s?!%[]))("'1.bin
 -dce full
 -dce full

+ 1 - 0
tests/unit/src/unit/MyClass.hx

@@ -1,5 +1,6 @@
 package unit;
 package unit;
 
 
+import haxe.ds.List;
 using MyClass.UsingBase;
 using MyClass.UsingBase;
 using MyClass.UsingChild1;
 using MyClass.UsingChild1;
 using MyClass.UsingChild2;
 using MyClass.UsingChild2;

+ 1 - 0
tests/unit/src/unit/TestMain.hx

@@ -1,6 +1,7 @@
 package unit;
 package unit;
 
 
 import unit.Test.*;
 import unit.Test.*;
+import haxe.ds.List;
 
 
 @:access(unit.Test)
 @:access(unit.Test)
 @:expose("unit.TestMain")
 @:expose("unit.TestMain")

+ 3 - 1
tests/unit/src/unit/TestReflect.hx

@@ -1,4 +1,6 @@
 package unit;
 package unit;
+
+import haxe.ds.List;
 import Type;
 import Type;
 
 
 interface InterfWithProp {
 interface InterfWithProp {
@@ -85,7 +87,7 @@ class TestReflect extends Test {
 
 
 	static var TNAMES = [
 	static var TNAMES = [
 		"null","Int","String","Bool","Float",
 		"null","Int","String","Bool","Float",
-		"Array",u("haxe.ds.StringMap"),u("List"),"Date","Xml","Math",
+		"Array",u("haxe.ds.StringMap"),u("haxe.ds.List"),"Date","Xml","Math",
 		u2("unit","MyEnum"),u2("unit","MyClass"),u2("unit","MySubClass"),
 		u2("unit","MyEnum"),u2("unit","MyClass"),u2("unit","MySubClass"),
 		#if !flash u #end("Class"), u("Enum"), u("Dynamic"),
 		#if !flash u #end("Class"), u("Enum"), u("Dynamic"),
 		u2("unit","MyInterface")
 		u2("unit","MyInterface")

+ 2 - 0
tests/unit/src/unit/TestSerialize.hx

@@ -1,5 +1,7 @@
 package unit;
 package unit;
 
 
+import haxe.ds.List;
+
 class TestSerialize extends Test {
 class TestSerialize extends Test {
 
 
 	function id<T>( v : T ) : T {
 	function id<T>( v : T ) : T {

+ 1 - 0
tests/unit/src/unit/TestSpecification.hx

@@ -1,5 +1,6 @@
 package unit;
 package unit;
 
 
+import haxe.ds.List;
 import haxe.macro.Expr;
 import haxe.macro.Expr;
 
 
 typedef T = {
 typedef T = {

+ 2 - 0
tests/unit/src/unit/TestType.hx

@@ -1,4 +1,6 @@
 package unit;
 package unit;
+
+import haxe.ds.List;
 import unit.MyEnum;
 import unit.MyEnum;
 import unit.MyClass;
 import unit.MyClass;
 import unit.HelperMacros.*;
 import unit.HelperMacros.*;

+ 2 - 0
tests/unit/src/unit/issues/Issue3110.hx

@@ -1,5 +1,7 @@
 package unit.issues;
 package unit.issues;
 
 
+import haxe.ds.List;
+
 private abstract MyOpaciteInt(Int) {}
 private abstract MyOpaciteInt(Int) {}
 
 
 class Issue3110 extends Test {
 class Issue3110 extends Test {

+ 2 - 0
tests/unit/src/unit/issues/Issue3486.hx

@@ -1,5 +1,7 @@
 package unit.issues;
 package unit.issues;
 
 
+import haxe.ds.List;
+
 class Issue3486 extends Test {
 class Issue3486 extends Test {
 	function test() {
 	function test() {
 		var l = new List();
 		var l = new List();

+ 2 - 0
tests/unit/src/unit/issues/Issue6177.hx

@@ -1,5 +1,7 @@
 package unit.issues;
 package unit.issues;
 
 
+import haxe.ds.List;
+
 class Issue6177 extends unit.Test {
 class Issue6177 extends unit.Test {
     function test() {
     function test() {
         var list = new List();
         var list = new List();

+ 2 - 2
tests/unit/src/unitstd/Lambda.unit.hx

@@ -16,11 +16,11 @@ e2.length == 0;
 var a = [1];
 var a = [1];
 var l = Lambda.list(a);
 var l = Lambda.list(a);
 name(a) == "Array";
 name(a) == "Array";
-name(l) == "List";
+name(l) == "haxe.ds.List";
 l.length == 1;
 l.length == 1;
 l.first() == 1;
 l.first() == 1;
 var l2 = Lambda.list(l);
 var l2 = Lambda.list(l);
-name(l2) == "List";
+name(l2) == "haxe.ds.List";
 l != l2;
 l != l2;
 var e = new List();
 var e = new List();
 var e2 = Lambda.list(e);
 var e2 = Lambda.list(e);