Skip to content

Commit

Permalink
[flash] call hasNext when constructing a StringMap iterator (see #3908)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Feb 25, 2015
1 parent a4bd0b1 commit 789c022
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions std/flash/_std/haxe/ds/StringMap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private class StringMapKeysIterator {
this.h = h;
this.rh = rh;
this.index = 0;
this.nextIndex = 0;
isReserved = false;
hasNext();
}

public inline function hasNext():Bool {
Expand Down Expand Up @@ -183,7 +183,7 @@ private class StringMapValuesIterator<T> {
this.h = h;
this.rh = rh;
this.index = 0;
this.nextIndex = 0;
hasNext();
}

public inline function hasNext():Bool {
Expand Down
11 changes: 8 additions & 3 deletions tests/unit/src/unitstd/Map.unit.hx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ map["bar"] = map["foo"] = 9;
map["bar"] == 9;
map["foo"] == 9;

/*
* ['' => ''].keys().next() == '';
*/
#if !(java || cs)
['' => ''].keys().next() == '';
['' => ''].iterator().next() == '';
[2 => 3].keys().next() == 2;
[2 => 3].iterator().next() == 3;
//[a => b].keys().next() == a;
//[a => b].iterator().next() == b;
#end

0 comments on commit 789c022

Please sign in to comment.