1
0
Ver Fonte

add an index position to block contexts

Nicolas Petton há 11 anos atrás
pai
commit
e45e0d225e
1 ficheiros alterados com 4 adições e 3 exclusões
  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;