public final class Locals
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
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,
Definition.Type type,
java.lang.String name,
boolean readonly)
Creates a new variable.
|
Definition |
getDefinition()
Whitelist against which this script is being compiled.
|
Definition.Method |
getMethod(Definition.MethodKey key)
Looks up a method.
|
Locals |
getProgramScope()
Returns the top-level program scope.
|
Definition.Type |
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,
Definition.Type returnType,
java.util.List<Locals.Parameter> parameters,
int maxLoopCounter)
Creates a new function scope inside the current scope
|
static Locals |
newLambdaScope(Locals programScope,
Definition.Type 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(Definition definition,
java.util.Collection<Definition.Method> 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 Locals newLocalScope(Locals currentScope)
public static Locals newLambdaScope(Locals programScope, Definition.Type returnType, java.util.List<Locals.Parameter> parameters, int captureCount, int maxLoopCounter)
This is just like newFunctionScope(org.elasticsearch.painless.Locals, org.elasticsearch.painless.Definition.Type, java.util.List<org.elasticsearch.painless.Locals.Parameter>, int), except the captured parameters are made read-only.
public static Locals newFunctionScope(Locals programScope, Definition.Type returnType, java.util.List<Locals.Parameter> parameters, int maxLoopCounter)
public static Locals newMainMethodScope(ScriptClassInfo scriptClassInfo, Locals programScope, int maxLoopCounter)
public static Locals newProgramScope(Definition definition, java.util.Collection<Definition.Method> methods)
public boolean hasVariable(java.lang.String name)
public Locals.Variable getVariable(Location location, java.lang.String name)
public Definition.Method getMethod(Definition.MethodKey key)
public Locals.Variable addVariable(Location location, Definition.Type type, java.lang.String name, boolean readonly)
public Definition.Type getReturnType()
public Locals getProgramScope()
public Definition getDefinition()