Przeglądaj źródła

Never reuse contexts. It's breaking the closure semantics.

Nicolas Petton 12 lat temu
rodzic
commit
72bf09f7e2
1 zmienionych plików z 1 dodań i 19 usunięć
  1. 1 19
      js/boot.js

+ 1 - 19
js/boot.js

@@ -627,11 +627,6 @@ function Smalltalk() {
 		return st.send(st.JSObjectProxy._on_(receiver), selector, args);
 	}
 
-	/* Reuse one old context stored in oldContext */
-
-	st.oldContext = null;
-
-
 	/* Handle thisContext pseudo variable */
 
 	st.getThisContext = function() {
@@ -639,25 +634,12 @@ function Smalltalk() {
 	};
 
 	function pushContext(receiver, selector, locals, lookupClass) {
-		var c = st.oldContext, tc = st.thisContext;
-		if(!c) {
-			return st.thisContext = new SmalltalkMethodContext(receiver, selector, locals, tc, lookupClass);
-
-		}
-		st.oldContext = null;
-
-		c.homeContext = tc;
-		c.receiver    = receiver;
-        c.selector    = selector || "";
-		c.locals      = locals || {};
-        c.lookupClass = lookupClass;
-		return st.thisContext = c;
+		return st.thisContext = new SmalltalkMethodContext(receiver, selector, locals, smalltalk.thisContext, lookupClass);
 	}
 
 	function popContext(context) {
 		st.thisContext = context.homeContext;
 		context.homeContext = undefined;
-		st.oldContext = context;
 	}
 
 	/* Convert a Smalltalk selector into a JS selector */