public class StaticScope extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
StaticScope.Type |
Modifier and Type | Field and Description |
---|---|
protected StaticScope |
enclosingScope |
protected IRScopeType |
scopeType |
Modifier | Constructor and Description |
---|---|
protected |
StaticScope(StaticScope.Type type,
StaticScope enclosingScope)
Construct a new static scope.
|
protected |
StaticScope(StaticScope.Type type,
StaticScope enclosingScope,
String file) |
protected |
StaticScope(StaticScope.Type type,
StaticScope enclosingScope,
String[] names)
Construct a new static scope.
|
Modifier and Type | Method and Description |
---|---|
AssignableNode |
addAssign(ISourcePosition position,
String name,
Node value) |
int |
addVariable(String name)
Add a new variable to this (current) scope unless it is already defined in any
reachable scope.
|
int |
addVariableThisScope(String name)
Add a new variable to this (current) scope unless it is already defined in the
current scope.
|
AssignableNode |
assign(ISourcePosition position,
String name,
Node value)
Make a DASgn or LocalAsgn node based on scope logic
|
AssignableNode |
assign(ISourcePosition position,
String name,
Node value,
StaticScope topScope,
int depth) |
Node |
declare(ISourcePosition position,
String name)
Make a DVar or LocalVar node based on scoping logic
|
Node |
declare(ISourcePosition position,
String name,
int depth) |
RubyModule |
determineModule()
Update current scoping structure to populate with proper cref scoping values.
|
StaticScope |
duplicate() |
int |
exists(String name)
Does the variable exist?
|
String[] |
getAllNamesInScope()
Get all visible variables that we can see from this scope that have been assigned
(e.g.
|
long |
getCommandArgumentStack() |
IRubyObject |
getConstant(String internedName) |
IRubyObject |
getConstantInner(String internedName) |
DynamicScope |
getDummyScope() |
StaticScope |
getEnclosingScope()
Next outer most scope in list of scopes.
|
String |
getFile() |
IRScope |
getIRScope() |
StaticScope |
getLocalScope()
Gets the Local Scope relative to the current Scope.
|
RubyModule |
getModule()
Get the live CRef module associated with this scope.
|
int |
getNumberOfVariables() |
RubyModule |
getOverlayModule(ThreadContext context) |
StaticScope |
getPreviousCRefScope() |
IRScopeType |
getScopeType() |
Signature |
getSignature()
For all block or method associated with static scopes this will return the signature for that
signature-providing scope.
|
StaticScope.Type |
getType() |
String[] |
getVariables() |
boolean |
isArgumentScope()
Argument scopes represent scopes which contain arguments for zsuper.
|
boolean |
isBlockScope() |
int |
isDefined(String name)
Is this name in the visible to the current scope
|
int |
isDefined(String name,
int depth) |
void |
makeArgumentScope() |
void |
setCommandArgumentStack(long commandArgumentStack) |
void |
setIRScope(IRScope irScope) |
void |
setModule(RubyModule module) |
void |
setPreviousCRefScope(StaticScope crefScope) |
void |
setScopeType(IRScopeType scopeType) |
void |
setSignature(Signature signature)
This happens in when first defining ArgsNodes or when reifying a method from AOT.
|
void |
setVariables(String[] names) |
String |
toString() |
protected final StaticScope enclosingScope
protected IRScopeType scopeType
protected StaticScope(StaticScope.Type type, StaticScope enclosingScope, String file)
protected StaticScope(StaticScope.Type type, StaticScope enclosingScope)
type
- the type of scopeenclosingScope
- the lexically containing scope.protected StaticScope(StaticScope.Type type, StaticScope enclosingScope, String[] names)
type
- the type of scopeenclosingScope
- the lexically containing scope.names
- The list of interned String variable names.public IRScope getIRScope()
public IRScopeType getScopeType()
public void setScopeType(IRScopeType scopeType)
public void setIRScope(IRScope irScope)
public int addVariableThisScope(String name)
name
- of new variablepublic int addVariable(String name)
name
- of new variablepublic String[] getVariables()
public int getNumberOfVariables()
public void setVariables(String[] names)
public IRubyObject getConstant(String internedName)
public IRubyObject getConstantInner(String internedName)
public StaticScope getEnclosingScope()
public int exists(String name)
name
- of the variable to findpublic int isDefined(String name)
name
- to be looked forpublic AssignableNode assign(ISourcePosition position, String name, Node value)
position
- name
- value
- public String[] getAllNamesInScope()
public int isDefined(String name, int depth)
public AssignableNode addAssign(ISourcePosition position, String name, Node value)
public AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth)
public Node declare(ISourcePosition position, String name, int depth)
public Node declare(ISourcePosition position, String name)
position
- the location that in the source that the new node will come fromname
- of the variable to be created is namedpublic StaticScope getLocalScope()
public RubyModule getModule()
public StaticScope getPreviousCRefScope()
public void setPreviousCRefScope(StaticScope crefScope)
public void setModule(RubyModule module)
public RubyModule determineModule()
public boolean isBlockScope()
public boolean isArgumentScope()
public void makeArgumentScope()
public Signature getSignature()
public void setSignature(Signature signature)
public DynamicScope getDummyScope()
public void setCommandArgumentStack(long commandArgumentStack)
public long getCommandArgumentStack()
public StaticScope.Type getType()
public String getFile()
public StaticScope duplicate()
public RubyModule getOverlayModule(ThreadContext context)
Copyright © 2001-2016 JRuby. All Rights Reserved.