Closed Bug 886976 Opened 11 years ago Closed 9 years ago

For ES6, all RegExp properties except lastIndex should be accessors

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1120169

People

(Reporter: bbenvie, Unassigned)

References

(Blocks 1 open bug)

Details

In order to support invariants of the language (frozen properties can't change) as well as the web reality that `RegExp.prototype.compile` exists (which can change the value of a RegExp's properties), ES6 changes all the instance properties (except lastIndex, which is writable) to accessors on `RegExp.prototype`.

See ES6 spec (May 2013 revision) sections:

* get RegExp.prototype.global - 15.10.6.3
* get RegExp.prototype.ignoreCase - 15.10.6.4
* get RegExp.prototype.multiline - 15.10.6.5
* get RegExp.prototype.source - 15.10.6.6
* get RegExp.prototype.sticky - 15.10.6.7

There is an obvious potential backward compatibility hazard with this change.

See also: https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-03/mar-13.md#regexp-global-ignorecase-multiline-source-sticky-are-now-prototype-accessor-properties-rather-than-instance-own-data-properties
Blocks: 899979
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.