public final class Locals
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Locals.LocalMethod
Stores information about methods directly callable on the generated script class.
|
static class |
Locals.Parameter |
static class |
Locals.Variable |
| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<java.lang.String> |
KEYWORDS
Set of reserved keywords.
|
static java.lang.String |
LOOP
Reserved word: loop counter
|
static java.lang.String |
THIS
Reserved word: unused
|
| Modifier and Type | Method and Description |
|---|---|
Locals.Variable |
addVariable(Location location,
java.lang.Class<?> clazz,
java.lang.String name,
boolean readonly)
Creates a new variable.
|
static java.lang.String |
buildLocalMethodKey(java.lang.String methodName,
int methodArity)
Constructs a local method key used to lookup local methods from a painless class.
|
Locals.LocalMethod |
getMethod(java.lang.String methodName,
int methodArity)
Looks up a method.
|
java.util.Map<java.lang.String,Locals.LocalMethod> |
getMethods() |
PainlessLookup |
getPainlessLookup()
Whitelist against which this script is being compiled.
|
Locals |
getProgramScope()
Returns the top-level program scope.
|
java.lang.Class<?> |
getReturnType()
Return type of this scope (e.g.
|
Locals.Variable |
getVariable(Location location,
java.lang.String name)
Accesses a variable.
|
boolean |
hasVariable(java.lang.String name)
Checks if a variable exists or not, in this scope or any parents.
|
static Locals |
newFunctionScope(Locals programScope,
java.lang.Class<?> returnType,
java.util.List<Locals.Parameter> parameters,
int maxLoopCounter)
Creates a new function scope inside the current scope
|
static Locals |
newLambdaScope(Locals programScope,
java.lang.String name,
java.lang.Class<?> returnType,
java.util.List<Locals.Parameter> parameters,
int captureCount,
int maxLoopCounter)
Creates a new lambda scope inside the current scope
|
static Locals |
newLocalScope(Locals currentScope)
Creates a new local variable scope (e.g.
|
static Locals |
newMainMethodScope(ScriptClassInfo scriptClassInfo,
Locals programScope,
int maxLoopCounter)
Creates a new main method scope
|
static Locals |
newProgramScope(PainlessLookup painlessLookup,
java.util.Collection<Locals.LocalMethod> methods)
Creates a new program scope: the list of methods.
|
public static final java.lang.String LOOP
public static final java.lang.String THIS
public static final java.util.Set<java.lang.String> KEYWORDS
public static java.lang.String buildLocalMethodKey(java.lang.String methodName,
int methodArity)
public static Locals newLocalScope(Locals currentScope)
public static Locals newLambdaScope(Locals programScope, java.lang.String name, java.lang.Class<?> returnType, java.util.List<Locals.Parameter> parameters, int captureCount, int maxLoopCounter)
This is just like newFunctionScope(org.elasticsearch.painless.Locals, java.lang.Class<?>, java.util.List<org.elasticsearch.painless.Locals.Parameter>, int), except the captured parameters are made read-only.
public static Locals newFunctionScope(Locals programScope, java.lang.Class<?> returnType, java.util.List<Locals.Parameter> parameters, int maxLoopCounter)
public static Locals newMainMethodScope(ScriptClassInfo scriptClassInfo, Locals programScope, int maxLoopCounter)
public static Locals newProgramScope(PainlessLookup painlessLookup, java.util.Collection<Locals.LocalMethod> methods)
public boolean hasVariable(java.lang.String name)
public Locals.Variable getVariable(Location location, java.lang.String name)
public Locals.LocalMethod getMethod(java.lang.String methodName, int methodArity)
public Locals.Variable addVariable(Location location, java.lang.Class<?> clazz, java.lang.String name, boolean readonly)
public java.lang.Class<?> getReturnType()
public Locals getProgramScope()
public PainlessLookup getPainlessLookup()
public java.util.Map<java.lang.String,Locals.LocalMethod> getMethods()