My favorites | Sign in
Project Home Downloads Wiki Issues Source Code Search
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 618: Simple constructors does not handle adding setters
10 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Closed:  Jun 2013

Sign in to add a comment
Project Member Reported by, Feb 18, 2010
A simple constructor is a function where there are only statements of the 
form this.x = ... where ... is either a constant or an argument, e.g.

function C() {
  this.x = 23;

If a setter is added to the prototype chain of a simple constructor setting 
one of the properties assigned in the constructor then this setter is 
ignored when constructing new objects from the constructor.

This only happens if the setter is added _after_ an instance has been 
created, e.g.

new C().x;  // Returns 23
C.prototype.__defineSetter__('x', function(value) { this.y = 23; });
new C().x;  // Still returns 23

Mar 4, 2010
Project Member #1
 Issue 629  has been merged into this issue.
Mar 4, 2010
Project Member #2
When this is fixed the test-api/SetterOnConstructorPrototype should be able to run as 
Jun 22, 2011
Please label with ES5 tag.
Jun 23, 2011
Project Member #4
(No comment was entered for this change.)
Labels: ES5
May 31, 2012
Project Member #5
I'm snatching this one, since it's closely related to the readonliness fix.
Jun 4, 2013
Project Member #6
I'm snatching this one harder. Will be fixed in
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting