public abstract 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 |
Modifier | Constructor and Description |
---|---|
protected |
StaticScope(StaticScope enclosingScope,
String[] names)
Construct a new static scope.
|
Modifier and Type | Method and Description |
---|---|
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
|
protected abstract 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
|
protected abstract Node |
declare(ISourcePosition position,
String name,
int depth) |
RubyModule |
determineModule()
Update current scoping structure to populate with proper cref scoping values.
|
int |
exists(String name)
Does the variable exist?
|
abstract String[] |
getAllNamesInScope()
Get all visible variables that we can see from this scope that have been assigned
(e.g.
|
Arity |
getArity() |
IRubyObject |
getConstant(String internedName) |
IRubyObject |
getConstantInner(String internedName) |
IRubyObject |
getConstantWithConstMissing(String internedName) |
DynamicScope |
getDummyScope() |
StaticScope |
getEnclosingScope()
Next outer most scope in list of scopes.
|
abstract StaticScope |
getLocalScope()
Gets the Local Scope relative to the current Scope.
|
RubyModule |
getModule()
Get the live CRef module associated with this scope.
|
int |
getNumberOfVariables() |
int |
getOptionalArgs() |
StaticScope |
getPreviousCRefScope() |
int |
getRequiredArgs() |
int |
getRestArg() |
abstract StaticScope.Type |
getType() |
String[] |
getVariables() |
abstract boolean |
isArgumentScope()
Argument scopes represent scopes which contain arguments for zsuper.
|
boolean |
isBlockScope() |
boolean |
isConstantDefined(String internedName) |
int |
isDefined(String name)
Is this name in the visible to the current scope
|
protected abstract int |
isDefined(String name,
int depth) |
abstract void |
makeArgumentScope() |
void |
setArities(int required,
int optional,
int rest) |
IRubyObject |
setConstant(String internedName,
IRubyObject result) |
void |
setModule(RubyModule module) |
void |
setPreviousCRefScope(StaticScope crefScope) |
void |
setRequiredArgs(int requiredArgs) |
void |
setRestArg(int restArg) |
void |
setVariables(String[] names) |
String |
toString() |
protected final StaticScope enclosingScope
protected StaticScope(StaticScope enclosingScope, String[] names)
enclosingScope
- The lexically containing scope.names
- The list of interned String variable names.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 getConstantWithConstMissing(String internedName)
public boolean isConstantDefined(String internedName)
public IRubyObject getConstant(String internedName)
public IRubyObject getConstantInner(String internedName)
public IRubyObject setConstant(String internedName, IRubyObject result)
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 abstract String[] getAllNamesInScope()
protected abstract int isDefined(String name, int depth)
protected abstract AssignableNode assign(ISourcePosition position, String name, Node value, StaticScope topScope, int depth)
protected abstract 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 abstract StaticScope getLocalScope()
public RubyModule getModule()
public StaticScope getPreviousCRefScope()
public void setPreviousCRefScope(StaticScope crefScope)
public void setModule(RubyModule module)
public RubyModule determineModule()
public int getOptionalArgs()
public int getRequiredArgs()
public void setRequiredArgs(int requiredArgs)
public int getRestArg()
public void setRestArg(int restArg)
public abstract boolean isArgumentScope()
public abstract void makeArgumentScope()
public boolean isBlockScope()
public Arity getArity()
public void setArities(int required, int optional, int rest)
public DynamicScope getDummyScope()
public abstract StaticScope.Type getType()
Copyright © 2001-2013 JRuby. All Rights Reserved.