Closed
Bug 233274
Opened 21 years ago
Closed 21 years ago
for/in loop goes through array elements in wrong order
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.5R5
People
(Reporter: hannesw, Assigned: igor)
Details
Attachments
(1 file)
User-Agent:
Build Identifier:
When an array is built using an array literal and elements are added to the
array later on (using array[x]=y or array.push(y)), looping through it with a
for-in loop goes through elements in wrong order. It seems the elements added
later are always processed first.
Reproducible: Always
Steps to Reproduce:
Rhino 1.5 release 5 0000 00 00
js> var array = [1, 2, 3];
js> array.push(4);
4
js> for (var i in array) print(i);
Actual Results:
3
0
1
2
Expected Results:
0
1
2
3
Reporter | ||
Comment 1•21 years ago
|
||
Reassigning to Igor (hope that's ok ;-)
Assignee: nboyd → igor
Summary: for/in loop goes through array elements in wrong order → for/in loop goes through array elements in wrong order
Assignee | ||
Comment 2•21 years ago
|
||
Since array literals in Rhino creates instances of NativeArray with the
internal dense array containing literal elements, the patch changes
NativeArray.getIds to return ids array with dense indexes coming first and
indexes for elements added later after that.
Assignee | ||
Comment 3•21 years ago
|
||
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•