scarpet corountines idea

This commit is contained in:
gnembon committed 2023-02-22 02:33:03 +01:00
1 parent 23ed35a398
commit 146573803c
11 files changed
+284 -17

No files matched your search

+14
View File
@@ -1,6 +1,7 @@
package carpet.script;
import carpet.script.exception.InternalExpressionException;
import carpet.script.value.ThreadValue;
import carpet.script.value.Value;
import java.util.HashMap;
@@ -30,6 +31,8 @@ public class Context
public final ScriptHost host;
private ThreadValue threadContext = null;
public Context(ScriptHost host)
{
this.host = host;
@@ -69,10 +72,21 @@ public class Context
public Context recreate()
{
Context ctx = duplicate();
ctx.threadContext = threadContext;
ctx.initialize();
return ctx;
}
public void setThreadContext(ThreadValue callingThread)
{
this.threadContext = callingThread;
}
public ThreadValue getThreadContext()
{
return threadContext;
}
protected void initialize()
{
//special variables for second order functions so we don't need to check them all the time