1
0
Преглед на файлове

add an index position to block contexts

Nicolas Petton преди 11 години
родител
ревизия
e45e0d225e
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  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;