-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
It seems like not deleting or resetting deferred._super and deferred._props after valueOf() is done could lead to odd behavior, e.g. if someone should happen to hold a reference to the deferred created by def("MyClass") and do something that invokes valueOf() a second (or third, or fourth…) time, unexpected things could happen to the prototype.
While this example is a bit contrived who knows what odd things might occur in real use:
def ("Person") ({
init: function(name){
this.name = name;
},
speak: function(text){
alert(text || "Hi, my name is " + this.name);
}
});
var NinjaDef = def ("Ninja");
NinjaDef << Person ({
init: function(name){
this._super();
},
kick: function(){
this.speak("I kick u!");
}
});
Person ({
guns: true
});
// This is a bit contrived, but... who knows what odd thing could happen to cause valueOf() to run
NinjaDef + 5;
var ninjy = new Ninja("JDD");
console.log("ninjy.name: ", ninjy.name); // should be JDD
console.log("ninjy.guns: ", ninjy.guns); // Ninjas don't use guns!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels