Package com.cloudbees.groovy.cps.impl
Class ProxyEnv
java.lang.Object
com.cloudbees.groovy.cps.impl.ProxyEnv
- All Implemented Interfaces:
DepthTrackingEnv,Env,Serializable
- Direct Known Subclasses:
BlockScopeEnv,CaseEnv,TryBlockEnv
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Field Summary
FieldsFields inherited from interface com.cloudbees.groovy.cps.DepthTrackingEnv
MAX_LEGAL_DEPTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildStackTraceElements(List<StackTraceElement> stack, int depth) Builds the current call stack information forThrowable.getStackTrace().Closure instance or 'this' object that surrounds the currently executing code.voiddeclareVariable(Class type, String name) Defines a local variable in the current environment.getBreakAddress(String label) If we see a break statement, where should we go?getContinueAddress(String label) If we see a continue statement, where should we go?intgetDepth()Return how deep this environment is within nested closure/function calls.getExceptionHandler(Class<? extends Throwable> type) Finds the exception handler that catches aThrowableinstance of this type.Invokeris typically scoped at the whole execution.getLocalVariable(String name) Obtains the current value of a local variable in the current environment.getLocalVariableType(String name) Where should the return statement return to?voidsetLocalVariable(String name, Object value) Sets the local variable to a new value.
-
Field Details
-
parent
-
-
Constructor Details
-
ProxyEnv
-
-
Method Details
-
declareVariable
Description copied from interface:EnvDefines a local variable in the current environment. This method is called when a variable declaration is encountered.- Specified by:
declareVariablein interfaceEnv- Parameters:
type- Type of the local variable.Objectwhen unknown/implicit (e.g. "def x")name- Name of the local variable.- See Also:
-
getLocalVariable
Description copied from interface:EnvObtains the current value of a local variable in the current environment.- Specified by:
getLocalVariablein interfaceEnv- Parameters:
name- Name of the local variable.- See Also:
-
setLocalVariable
Description copied from interface:EnvSets the local variable to a new value.- Specified by:
setLocalVariablein interfaceEnv- Parameters:
name- Name of the local variable.value- New value- See Also:
-
getLocalVariableType
- Specified by:
getLocalVariableTypein interfaceEnv
-
closureOwner
Description copied from interface:EnvClosure instance or 'this' object that surrounds the currently executing code.If 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.
- Specified by:
closureOwnerin interfaceEnv
-
getReturnAddress
Description copied from interface:EnvWhere should the return statement return to?- Specified by:
getReturnAddressin interfaceEnv
-
getBreakAddress
Description copied from interface:EnvIf we see a break statement, where should we go?- Specified by:
getBreakAddressin interfaceEnv- Parameters:
label- Specifies the loop to break from. null for nearest loop.- Returns:
- For semantically correct Groovy code, the return value is never null, because not having the matching label is a compile-time error.
-
getContinueAddress
Description copied from interface:EnvIf we see a continue statement, where should we go?- Specified by:
getContinueAddressin interfaceEnv- Parameters:
label- Specifies the loop to repeat. null for nearest loop.- Returns:
- For semantically correct Groovy code, the return value is never null, because not having the matching label is a compile-time error.
-
getExceptionHandler
Description copied from interface:EnvFinds the exception handler that catches aThrowableinstance of this type.- Specified by:
getExceptionHandlerin interfaceEnv- Returns:
- never null. Even if there's no user-specified exception handler, the default 'unhandled exception handler' must be returned.
-
getInvoker
Description copied from interface:EnvInvokeris typically scoped at the whole execution.- Specified by:
getInvokerin interfaceEnv- Returns:
- never null
-
buildStackTraceElements
Description copied from interface:EnvBuilds the current call stack information forThrowable.getStackTrace().- Specified by:
buildStackTraceElementsin interfaceEnvdepth- Maximum depth of stack trace to obtain.
-
getDepth
public int getDepth()Description copied from interface:DepthTrackingEnvReturn how deep this environment is within nested closure/function calls.- Specified by:
getDepthin interfaceDepthTrackingEnv
-