Skip to content

Commit

Permalink
Making sure the mutators are executed before implementing the other m…
Browse files Browse the repository at this point in the history
…ethods. Fixes #642, more details there.
  • Loading branch information
fabiomcosta committed Jun 9, 2010
1 parent 563cde8 commit 2785a57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/Class/Class.js
Expand Up @@ -28,6 +28,13 @@ var Class = this.Class = new Type('Class', function(params){
this.$caller = this.caller = null;
return value;
}.extend(this);

for (var mutator in Class.Mutators){
if (!params[mutator]) continue;
var value = Class.Mutators[mutator].call(newClass, params[mutator]);
if (value == null) delete params[mutator];
else params[mutator] = value;
}

newClass.implement(params);

Expand Down Expand Up @@ -78,11 +85,6 @@ var wrap = function(self, key, method){

var implement = function(key, value, retain){

if (Class.Mutators.hasOwnProperty(key)){
value = Class.Mutators[key].call(this, value);
if (value == null) return this;
}

if (typeOf(value) == 'function'){
if (value.$hidden) return this;
this.prototype[key] = (retain) ? value : wrap(this, key, value);
Expand Down

0 comments on commit 2785a57

Please sign in to comment.