public class FunctionCallEnv extends Object
MAX_LEGAL_DEPTH| Constructor and Description |
|---|
FunctionCallEnv(Env caller,
Continuation returnAddress,
SourceLocation loc,
Object _this) |
FunctionCallEnv(Env caller,
Continuation returnAddress,
SourceLocation loc,
Object _this,
int localsCount) |
| Modifier and Type | Method and Description |
|---|---|
void |
buildStackTraceElements(List<StackTraceElement> stack,
int depth)
Builds the current call stack information for
Throwable.getStackTrace(). |
Object |
closureOwner()
Closure instance or 'this' object that surrounds the currently executing code.
|
void |
declareVariable(Class type,
String name)
Defines a local variable in the current environment.
|
Continuation |
getBreakAddress(String label)
If we see a break statement, where should we go?
|
Continuation |
getContinueAddress(String label)
If we see a continue statement, where should we go?
|
int |
getDepth()
Return how deep this environment is within nested closure/function calls.
|
Continuation |
getExceptionHandler(Class<? extends Throwable> type)
Finds the exception handler that catches a
Throwable instance of this type. |
Invoker |
getInvoker()
Invoker is typically scoped at the whole execution. |
Object |
getLocalVariable(String name)
Obtains the current value of a local variable in the current environment.
|
Class |
getLocalVariableType(String name) |
Continuation |
getReturnAddress()
Where should the return statement return to?
|
protected Map<String,Class> |
getTypes()
Because might deserialize old version of class with null value for field
|
protected Map<String,Class> |
getTypesForMutation()
Used when we are actually going to mutate the types info
|
void |
setInvoker(Invoker invoker)
Sets the
Invoker, which gets inherited through the call chain. |
void |
setLocalVariable(String name,
Object value)
Sets the local variable to a new value.
|
public FunctionCallEnv(Env caller, Continuation returnAddress, SourceLocation loc, Object _this)
caller - The environment of the call site. Can be null but only if the caller is outside CPS execution.public FunctionCallEnv(Env caller, Continuation returnAddress, SourceLocation loc, Object _this, int localsCount)
public void declareVariable(Class type, String name)
Envtype - Type of the local variable. Object when unknown/implicit (e.g. "def x")name - Name of the local variable.VariableDeclBlockpublic Object getLocalVariable(String name)
Envname - Name of the local variable.LocalVariableBlockpublic void setLocalVariable(String name, Object value)
Envname - Name of the local variable.value - New valueLocalVariableBlockpublic Object closureOwner()
EnvIf a new closure instantiation is encountered, this is the object that becomes the owner of that closure.
Dynamic property access inside closures are also resolved against this instance.
protected Map<String,Class> getTypes()
protected Map<String,Class> getTypesForMutation()
public Class getLocalVariableType(String name)
getLocalVariableType in interface Envpublic void setInvoker(Invoker invoker)
Invoker, which gets inherited through the call chain.public Invoker getInvoker()
EnvInvoker is typically scoped at the whole execution.getInvoker in interface Envpublic final Continuation getReturnAddress()
EnvgetReturnAddress in interface Envpublic final Continuation getBreakAddress(String label)
EnvgetBreakAddress in interface Envlabel - Specifies the loop to break from. null for nearest loop.public final Continuation getContinueAddress(String label)
EnvgetContinueAddress in interface Envlabel - Specifies the loop to repeat. null for nearest loop.public final Continuation getExceptionHandler(Class<? extends Throwable> type)
EnvThrowable instance of this type.getExceptionHandler in interface Envpublic void buildStackTraceElements(List<StackTraceElement> stack, int depth)
EnvThrowable.getStackTrace().buildStackTraceElements in interface Envdepth - Maximum depth of stack trace to obtain.public int getDepth()
DepthTrackingEnvgetDepth in interface DepthTrackingEnvCopyright © 2011–2019. All rights reserved.