Browse Source

Extract method: wireKlass.

Herbert Vojčík 12 years ago
parent
commit
4e96385bcb
1 changed files with 10 additions and 14 deletions
  1. 10 14
      js/boot.js

+ 10 - 14
js/boot.js

@@ -229,15 +229,7 @@ function Smalltalk() {
                 writable: true
             }
 		});
-
-        Object.defineProperties(klass.fn.prototype, {
-			klass: { 
-                value: klass, 
-                enumerable: false, 
-                configurable: true, 
-                writable: true 
-            }
-		});
+		wireKlass(klass);
 	}
 
 	/* Smalltalk method object. To add a method to a class,
@@ -279,16 +271,20 @@ function Smalltalk() {
         }
     };
 
-    function installSuperclass(klass) {
+	function wireKlass(klass) {
+		Object.defineProperty(klass.fn.prototype, "klass", {
+			value: klass, enumerable: false, configurable: true, writable: true
+		});
+	}
+
+	function installSuperclass(klass) {
         // only if the klass has not been initialized yet.
 		if(klass.fn.prototype._yourself) { return; }
 
 		if(klass.superclass && klass.superclass !== nil) {
             inherits(klass.fn, klass.superclass.fn);
-            Object.defineProperties(klass.fn.prototype, {
-			    klass: { value: klass, enumerable: false, configurable: true, writable: true }
-		    });
-            reinstallMethods(klass);
+			wireKlass(klass);
+			reinstallMethods(klass);
         }
 	}