浏览代码

Merge pull request #253 from herby/master

Small boot refactorings/optimizations.
Nicolas Petton 11 年之前
父节点
当前提交
d41715ea59
共有 1 个文件被更改,包括 7 次插入8 次删除
  1. 7 8
      js/boot.js

+ 7 - 8
js/boot.js

@@ -147,7 +147,6 @@ function Smalltalk(){
 		var that = setupClass(meta.instanceClass, spec);
 		that.className = spec.className;
 		meta.className = spec.className + ' class';
-        that.organization = new SmalltalkOrganizer();
 		if(spec.superclass) {
 			that.superclass = spec.superclass;
 			meta.superclass = spec.superclass.klass;
@@ -157,7 +156,6 @@ function Smalltalk(){
 	
 	function metaclass() {
 		var meta = setupClass(new SmalltalkMetaclass(), {})
-        meta.organization = new SmalltalkOrganizer();
 		meta.instanceClass = new meta.fn;
 		return meta;
 	}
@@ -169,6 +167,7 @@ function Smalltalk(){
 			value: function() { return 'Smalltalk ' + this.className; }, 
             configurable: true // no writable - in par with ES6 methods
 		});
+        that.organization = new SmalltalkOrganizer();
 		that.pkg = spec.pkg;
 		Object.defineProperties(that.fn.prototype, {
 			methods: { value: {}, enumerable: false, configurable: true, writable: true },
@@ -581,12 +580,6 @@ function SmalltalkMethodContext(receiver, selector, method, temps, home) {
 	this.method      = method;
 	this.temps       = temps || {};
 	this.homeContext = home;
-
-    this.resume = function() {
-        //Brutally set the receiver as thisContext, then re-enter the function
-        smalltalk.thisContext = this;
-        return this.method.apply(receiver, temps);
-    };
 };
 
 SmalltalkMethodContext.prototype.copy = function() {
@@ -601,6 +594,12 @@ SmalltalkMethodContext.prototype.copy = function() {
 	);
 };
 
+SmalltalkMethodContext.prototype.resume = function() {
+    //Brutally set the receiver as thisContext, then re-enter the function
+    smalltalk.thisContext = this;
+    return this.method.apply(receiver, temps);
+};
+
 /* Global Smalltalk objects. */
 
 var nil = new SmalltalkNil();