Closed Bug 456389 Opened 16 years ago Closed 15 years ago

Implement JS 1.8 reduce/reduceRight array methods

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hannesw, Assigned: norrisboyd)

References

Details

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1
Build Identifier: 

Implement JavaScript 1.8 reduce/reduceRight array methods. See bug #363040 for spicermonkey implementation.

Reproducible: Always
Implements reduce and reduceRight methods on array prototype and constructor. I tried to reproduce the behaviour of spidermonkey, especially for sparse/empty arrays.
Attached patch improved patchSplinter Review
Patch with minor improvements and fixes.
Attachment #339794 - Attachment is obsolete: true
Assignee: nobody → norrisboyd
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Blocks: 489326
Committed the last patch to CVS HEAD:

Checking in src/org/mozilla/javascript/NativeArray.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeArray.java,v  <--  NativeArray.java
new revision: 1.97; previous revision: 1.96
done
Checking in src/org/mozilla/javascript/resources/Messages.properties;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/resources/Messages.properties,v  <--  Messages.properties
new revision: 1.91; previous revision: 1.90
done
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
As per 15.4.4.21 step 5, and 15.4.4.22 step 5 of the spec.
(In reply to comment #4)
> Created an attachment (id=391093) [details]
> reduce and reduceRight throw a TypeError when array empty and no initVal
> 
> As per 15.4.4.21 step 5, and 15.4.4.22 step 5 of the spec.

Committed:

Checking in src/org/mozilla/javascript/NativeArray.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeArray.java,v  <--  NativeArray.java
new revision: 1.105; previous revision: 1.104
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: