X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Fjs%2FJSFunction.java;h=8e5c92aee82c06fdc79b734cbfb5e93554468f7d;hb=6261c41b2ac9d182d8c3541e8e0e5fd00062fa43;hp=c15ef55272ffb8129b42846a9a84e6ce00bea101;hpb=a374e033525b9c872cf47b10c066afbb532bf7c4;p=org.ibex.core.git diff --git a/src/org/xwt/js/JSFunction.java b/src/org/xwt/js/JSFunction.java index c15ef55..8e5c92a 100644 --- a/src/org/xwt/js/JSFunction.java +++ b/src/org/xwt/js/JSFunction.java @@ -6,7 +6,7 @@ import java.util.*; import java.io.*; /** A JavaScript function, compiled into bytecode */ -public class JSFunction extends JS implements ByteCodes, Tokens { +public class JSFunction extends JS implements ByteCodes, Tokens, org.xwt.Scheduler.Task { // Fields and Accessors /////////////////////////////////////////////// @@ -26,6 +26,14 @@ public class JSFunction extends JS implements ByteCodes, Tokens { // Public ////////////////////////////////////////////////////////////////////////////// + // FEATURE: make sure that this can only be called from the Scheduler... + /** if you enqueue a function, it gets invoked in its own pauseable context */ + public void perform() throws JSExn { + Interpreter i = new Interpreter(this, true, new JSArray()); + int oldpausecount = i.pausecount; + i.resume(); + } + /** parse and compile a function */ public static JSFunction fromReader(String sourceName, int firstLine, Reader sourceCode) throws IOException { JSFunction ret = new JSFunction(sourceName, firstLine, null);