Browse Source

DRYing Organizer creation.
(cherry-picked from 199a302)

Herbert Vojčík 12 years ago
parent
commit
137aeac989
1 changed files with 13 additions and 14 deletions
  1. 13 14
      js/boot.js

+ 13 - 14
js/boot.js

@@ -190,7 +190,6 @@ function Smalltalk() {
         that.className = spec.className;
         that.wrapped   = spec.wrapped || false;
 		meta.className = spec.className + ' class';
-        that.organization = new SmalltalkOrganizer();
 		if(spec.superclass) {
 			that.superclass = spec.superclass;
 			meta.superclass = spec.superclass.klass;
@@ -199,18 +198,17 @@ function Smalltalk() {
 	}
 
 	function metaclass(spec) {
-        var superConstructor;
-        spec = spec || {};
+		var superConstructor;
+		spec = spec || {};
 
-        if(spec.superclass) {
-            superConstructor = spec.superclass.klass.fn;
-        } else {
-            superConstructor = SmalltalkClass;
-        }
+		if(spec.superclass) {
+			superConstructor = spec.superclass.klass.fn;
+		} else {
+			superConstructor = SmalltalkClass;
+		}
 
 		var that = new SmalltalkMetaclass();
         that.fn            = function() {};
-        that.organization  = new SmalltalkOrganizer();
         inherits(that.fn, superConstructor);
 
         setupClass(that);
@@ -232,12 +230,13 @@ function Smalltalk() {
             configurable: true
 		});
 
+		klass.organization = new SmalltalkOrganizer();
 		Object.defineProperties(klass, {
-			methods: { 
-                value: {}, 
-                enumerable: false, 
-                configurable: true, 
-                writable: true 
+			methods: {
+                value: {},
+                enumerable: false,
+                configurable: true,
+                writable: true
             }
 		});