public class ProxyEnv extends Object implements DepthTrackingEnv
| Modifier and Type | Field and Description |
|---|---|
protected Env |
parent |
MAX_LEGAL_DEPTH| 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?
|
void |
setLocalVariable(String name,
Object value)
Sets the local variable to a new value.
|
protected final Env parent
public ProxyEnv(Env parent)
public void declareVariable(Class type, String name)
EnvdeclareVariable in interface 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)
EnvgetLocalVariable in interface Envname - Name of the local variable.LocalVariableBlockpublic void setLocalVariable(String name, Object value)
EnvsetLocalVariable in interface Envname - Name of the local variable.value - New valueLocalVariableBlockpublic Class getLocalVariableType(String name)
getLocalVariableType in interface Envpublic 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.
closureOwner in interface Envpublic Continuation getReturnAddress()
EnvgetReturnAddress in interface Envpublic Continuation getBreakAddress(String label)
EnvgetBreakAddress in interface Envlabel - Specifies the loop to break from. null for nearest loop.public Continuation getContinueAddress(String label)
EnvgetContinueAddress in interface Envlabel - Specifies the loop to repeat. null for nearest loop.public Continuation getExceptionHandler(Class<? extends Throwable> type)
EnvThrowable instance of this type.getExceptionHandler in interface Envpublic Invoker getInvoker()
EnvInvoker is typically scoped at the whole execution.getInvoker 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.