Skip to content

Commit

Permalink
For subclasses, the prototype must be assigned before new properties …
Browse files Browse the repository at this point in the history
…are added to it.
  • Loading branch information
jcoglan committed Aug 13, 2008
1 parent 3093cd9 commit c98d9ce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions source/compiler.js
Expand Up @@ -40,6 +40,7 @@ JS.ClassCompiler = new JS.Class({

declaration: function() {
var str = this._className + ' = ' + this._subject.toString() + ';\n';
if (this._subject.superclass != Object) str += this.subclass();
str += this._className + '.prototype.constructor = \n';
str += this._className + '.prototype.klass = ' + this._className + ';\n';
var superclass = this._subject.superclass;
Expand Down Expand Up @@ -79,10 +80,7 @@ JS.ClassCompiler = new JS.Class({
},

instanceMethods: function() {
var str = '';
if (this._subject.superclass != Object) str += this.subclass();

var anc = this._subject.ancestors(), methods = {}, method;
var anc = this._subject.ancestors(), methods = {}, str = '', method;
for (var i = 0, n = anc.length; i < n; i++) {
if (anc[i] == JS.ObjectMethods) continue;
JS.extend(methods, anc[i].__mod__.__fns__);
Expand Down

0 comments on commit c98d9ce

Please sign in to comment.