Browse Source

add an index position to block contexts

Nicolas Petton 11 years ago
parent
commit
e45e0d225e
1 changed files with 4 additions and 3 deletions
  1. 4 3
      js/boot.js

+ 4 - 3
js/boot.js

@@ -557,10 +557,10 @@ function Smalltalk() {
 		}
 	}
 
-	st.withContext = function(worker, setup) {
+	st.withContext = function(worker, setup, index) {
 		if(st.thisContext) {
             st.thisContext.pc++;
-			return inContext(worker, setup);
+			return inContext(worker, setup, index);
 		} else {
 			try {return inContext(worker, setup)}
 			catch(error) {
@@ -582,8 +582,9 @@ function Smalltalk() {
 		}
 	};
 
-	function inContext(worker, setup) {
+	function inContext(worker, setup, index) {
 		var context = pushContext(setup);
+        context.index = index || 0;
 		var result = worker(context);
 		popContext(context);
 		return result;