mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 03:49:37 +00:00
Compatibility with Rhino+Continuations fork: Continuation class is moved to continuations package.
This commit is contained in:
parent
d63e7dd41d
commit
343070e937
@ -44,6 +44,7 @@ package org.mozilla.javascript;
|
||||
import java.io.*;
|
||||
|
||||
import org.mozilla.javascript.debug.*;
|
||||
import org.mozilla.javascript.continuations.Continuation;
|
||||
|
||||
public class Interpreter
|
||||
{
|
||||
@ -275,7 +276,7 @@ public class Interpreter
|
||||
|
||||
ContinuationJump(Continuation c, CallFrame current)
|
||||
{
|
||||
this.capturedFrame = (CallFrame)c.data;
|
||||
this.capturedFrame = (CallFrame)c.getImplementation();
|
||||
if (this.capturedFrame == null || current == null) {
|
||||
// Continuation and current execution does not share
|
||||
// any frames if there is nothing to capture or
|
||||
@ -2169,8 +2170,8 @@ public class Interpreter
|
||||
return result;
|
||||
}
|
||||
|
||||
static Object restartContinuation(Continuation c, Context cx,
|
||||
Scriptable scope, Object[] args)
|
||||
public static Object restartContinuation(Continuation c, Context cx,
|
||||
Scriptable scope, Object[] args)
|
||||
{
|
||||
if (!ScriptRuntime.hasTopCall(cx)) {
|
||||
return ScriptRuntime.doTopCall(c, cx, scope, null, args);
|
||||
@ -2183,7 +2184,7 @@ public class Interpreter
|
||||
arg = args[0];
|
||||
}
|
||||
|
||||
CallFrame capturedFrame = (CallFrame)c.data;
|
||||
CallFrame capturedFrame = (CallFrame)c.getImplementation();
|
||||
if (capturedFrame == null) {
|
||||
// No frames to restart
|
||||
return arg;
|
||||
@ -3870,7 +3871,7 @@ switch (op) {
|
||||
x = x.parentFrame;
|
||||
}
|
||||
|
||||
c.data = frame.parentFrame;
|
||||
c.initImplementation(frame.parentFrame);
|
||||
frame.stack[stackTop] = c;
|
||||
}
|
||||
|
||||
@ -4011,5 +4012,4 @@ switch (op) {
|
||||
cx.instructionCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ import java.util.ResourceBundle;
|
||||
|
||||
import org.mozilla.javascript.xml.XMLObject;
|
||||
import org.mozilla.javascript.xml.XMLLib;
|
||||
import org.mozilla.javascript.continuations.Continuation;
|
||||
|
||||
/**
|
||||
* This is the class that implements the runtime.
|
||||
|
@ -33,20 +33,34 @@
|
||||
* file under either the NPL or the GPL.
|
||||
*/
|
||||
|
||||
package org.mozilla.javascript;
|
||||
package org.mozilla.javascript.continuations;
|
||||
|
||||
import org.mozilla.javascript.*;
|
||||
|
||||
public final class Continuation extends IdScriptableObject implements Function
|
||||
{
|
||||
private static final Object FTAG = new Object();
|
||||
|
||||
Object data;
|
||||
private Object implementation;
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
public static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
{
|
||||
Continuation obj = new Continuation();
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
}
|
||||
|
||||
public Object getImplementation()
|
||||
{
|
||||
return implementation;
|
||||
}
|
||||
|
||||
public void initImplementation(Object implementation)
|
||||
{
|
||||
if (implementation == null) throw new IllegalArgumentException();
|
||||
if (this.implementation != null) throw new IllegalStateException();
|
||||
this.implementation = implementation;
|
||||
}
|
||||
|
||||
public String getClassName()
|
||||
{
|
||||
return "Continuation";
|
||||
@ -63,7 +77,7 @@ public final class Continuation extends IdScriptableObject implements Function
|
||||
return Interpreter.restartContinuation(this, cx, scope, args);
|
||||
}
|
||||
|
||||
static boolean isContinuationConstructor(IdFunctionObject f)
|
||||
public static boolean isContinuationConstructor(IdFunctionObject f)
|
||||
{
|
||||
if (f.hasTag(FTAG) && f.methodId() == Id_constructor) {
|
||||
return true;
|
Loading…
x
Reference in New Issue
Block a user