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

Don't use field for ListIterator next var, unless we're on js with analyzer turned off, because all other targets (or js with analyzer) inline "next" with var properly

Dan Korostelev 9 жил өмнө
parent
commit
ab43455629
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      std/List.hx

+ 3 - 3
std/List.hx

@@ -262,11 +262,11 @@ private class ListNode<T> {
 
 private class ListIterator<T> {
 	var head:ListNode<T>;
-	var val:Dynamic;
+	#if (js && !analyzer) var val:Dynamic; #end
 
 	public inline function new(head:ListNode<T>) {
 		this.head = head;
-		this.val = null;
+		#if (js && !analyzer) this.val = null; #end
 	}
 
 	public inline function hasNext():Bool {
@@ -274,7 +274,7 @@ private class ListIterator<T> {
 	}
 
 	public inline function next():T {
-		val = head.item;
+		#if (!js || analyzer) var #end val = head.item;
 		head = head.next;
 		return val;
 	}