Browse Source

fixed iterator methods.

Nicolas Cannasse 18 years ago
parent
commit
e4e64f2f52
2 changed files with 28 additions and 27 deletions
  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
 	fixed no error when invalid "catch" expression
 	remove variance
 	remove variance
 	fixed prototype bug in neko when "Main" class is defined
 	fixed prototype bug in neko when "Main" class is defined
+	fixed flash9 xml iterator methods
 
 
 2007-05-18: 1.13
 2007-05-18: 1.13
 	fixed bug with local variable masking package in catch type
 	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(){
 	public function iterator(){
 		if( _children == null ) throw "bad nodetype";
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function(){
 			hasNext : function(){
-				return this.cur < this.x.length;
+				return cur < x.length;
 			},
 			},
 			next : function(){
 			next : function(){
-				return this.x[this.cur++];
+				return x[cur++];
 			}
 			}
 		}
 		}
 	}
 	}
 
 
 	public function elements(){
 	public function elements(){
 		if( _children == null ) throw "bad nodetype";
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function() {
 			hasNext : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
 				while( k < l ) {
-					if( this.x[k].nodeType == Xml.Element )
+					if( x[k].nodeType == Xml.Element )
 						break;
 						break;
 					k += 1;
 					k += 1;
 				}
 				}
-				this.cur = k;
+				cur = k;
 				return k < l;
 				return k < l;
 			},
 			},
 			next : function() {
 			next : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					k += 1;
 					k += 1;
 					if( n.nodeType == Xml.Element ) {
 					if( n.nodeType == Xml.Element ) {
-						this.cur = k;
+						cur = k;
 						return n;
 						return n;
 					}
 					}
 				}
 				}
@@ -317,29 +317,29 @@ class FlashXml__ {
 
 
 	public function elementsNamed( name : String ) {
 	public function elementsNamed( name : String ) {
 		if( _children == null ) throw "bad nodetype";
 		if( _children == null ) throw "bad nodetype";
-		return untyped {
-			cur: 0,
-			x: this._children,
+		var cur = 0;
+		var x = _children;
+		return {
 			hasNext : function() {
 			hasNext : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					if( n.nodeType == Xml.Element && n._nodeName == name )
 					if( n.nodeType == Xml.Element && n._nodeName == name )
 						break;
 						break;
 					k++;
 					k++;
 				}
 				}
-				this.cur = k;
+				cur = k;
 				return k < l;
 				return k < l;
 			},
 			},
 			next : function() {
 			next : function() {
-				var k = this.cur;
-				var l = this.x.length;
+				var k = cur;
+				var l = x.length;
 				while( k < l ) {
 				while( k < l ) {
-					var n = this.x[k];
+					var n = x[k];
 					k++;
 					k++;
 					if( n.nodeType == Xml.Element && n._nodeName == name ) {
 					if( n.nodeType == Xml.Element && n._nodeName == name ) {
-						this.cur = k;
+						cur = k;
 						return n;
 						return n;
 					}
 					}
 				}
 				}