Jelajahi Sumber

fixed iterator methods.

Nicolas Cannasse 18 tahun lalu
induk
melakukan
e4e64f2f52
2 mengubah file dengan 28 tambahan dan 27 penghapusan
  1. 1 0
      doc/CHANGES.txt
  2. 27 27
      std/flash9/FlashXml__.hx

+ 1 - 0
doc/CHANGES.txt

@@ -2,6 +2,7 @@
 	fixed no error when invalid "catch" expression
 	remove variance
 	fixed prototype bug in neko when "Main" class is defined
+	fixed flash9 xml iterator methods
 
 2007-05-18: 1.13
 	fixed bug with local variable masking package in catch type

+ 27 - 27
std/flash9/FlashXml__.hx

@@ -271,42 +271,42 @@ class FlashXml__ {
 
 	public function iterator(){
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function(){
-				return this.cur < this.x.length;
+				return cur < x.length;
 			},
 			next : function(){
-				return this.x[this.cur++];
+				return x[cur++];
 			}
 		}
 	}
 
 	public function elements(){
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
-					if( this.x[k].nodeType == Xml.Element )
+					if( x[k].nodeType == Xml.Element )
 						break;
 					k += 1;
 				}
-				this.cur = k;
+				cur = k;
 				return k < l;
 			},
 			next : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					k += 1;
 					if( n.nodeType == Xml.Element ) {
-						this.cur = k;
+						cur = k;
 						return n;
 					}
 				}
@@ -317,29 +317,29 @@ class FlashXml__ {
 
 	public function elementsNamed( name : String ) {
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					if( n.nodeType == Xml.Element && n._nodeName == name )
 						break;
 					k++;
 				}
-				this.cur = k;
+				cur = k;
 				return k < l;
 			},
 			next : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					k++;
 					if( n.nodeType == Xml.Element && n._nodeName == name ) {
-						this.cur = k;
+						cur = k;
 						return n;
 					}
 				}