public final class Scope extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
Scope.Builder
Builder to create a new
Scope object. |
| Modifier and Type | Method and Description |
|---|---|
Object |
getArguments()
Get arguments of this scope.
|
String |
getName()
Human readable name of this scope.
|
Node |
getNode()
Get a node representing this scope.
|
Object |
getReceiver()
Get a receiver object of this scope.
|
String |
getReceiverName()
Get code name of the receiver object, if there is any.
|
Object |
getRootInstance()
Get the root instance object of this scope.
|
Object |
getVariables()
Get variables declared in this scope.
|
static Scope.Builder |
newBuilder(String name,
Object variables)
Create a new Scope builder.
|
public static Scope.Builder newBuilder(String name, Object variables)
The properties representing the variables needs to have deterministic iteration order, variable declaration order is recommended.
name - name of the scope, a name description like block, name of a function, closure,
script, module, etc.variables - a TruffleObject containing the
variables as its properties, never null. Must respond true to
HAS_KEYS.public String getName()
public Node getNode()
RootNode
, top scopes do not have a node associated.null when no node is associated.public Object getVariables()
Node (and a Frame) was provided
when this scope was obtained, variables are valid at that specified Node (and
Frame).
The properties representing the variables have deterministic iteration order, variable declaration order is preferred.
TruffleObject containing the variables as
its properties, never null.public Object getArguments()
Frame instances were provided.
The properties representing the arguments have deterministic iteration order, argument declaration order is preferred.
TruffleObject containing the arguments as
its properties for named arguments, or as its array for unnamed arguments. A
null is returned when this scope does not have a concept of arguments.
An empty TruffleObject is provided when it has a sense to have arguments (e.g.
function scope), but there are none.public Object getReceiver()
this
in Java or JavaScript and self in Ruby, for instance.
The scope that represents the function provide receiver object, if there is one, other scopes do not provide it, unless they override it.
null when there is no receiverScope.getReceiverName()public Object getRootInstance()
null when no such instance exists.public String getReceiverName()
receiver object, or null.Scope.getReceiver()