public abstract class StaticScope
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected StaticScope |
enclosingScope |
Modifier | Constructor and Description |
---|---|
protected |
StaticScope(StaticScope enclosingScope,
java.lang.String[] names)
Construct a new static scope.
|
Modifier and Type | Method and Description |
---|---|
int |
addVariable(java.lang.String name)
Add a new variable to this (current) scope unless it is already defined in any
reachable scope.
|
int |
addVariableThisScope(java.lang.String name)
Add a new variable to this (current) scope unless it is already defined in the
current scope.
|
AssignableNode |
assign(ISourcePosition position,
java.lang.String name,
Node value)
Make a DASgn or LocalAsgn node based on scope logic
|
protected abstract AssignableNode |
assign(ISourcePosition position,
java.lang.String name,
Node value,
StaticScope topScope,
int depth) |
void |
capture(int index) |
Node |
declare(ISourcePosition position,
java.lang.String name)
Make a DVar or LocalVar node based on scoping logic
|
protected abstract Node |
declare(ISourcePosition position,
java.lang.String name,
int depth) |
RubyModule |
determineModule()
Update current scoping structure to populate with proper cref scoping values.
|
int |
exists(java.lang.String name)
Does the variable exist?
|
abstract java.lang.String[] |
getAllNamesInScope()
Get all visible variables that we can see from this scope that have been assigned
(e.g.
|
Arity |
getArity() |
IRubyObject |
getConstant(Ruby runtime,
java.lang.String internedName,
RubyModule object) |
IRubyObject |
getConstantWithConstMissing(Ruby runtime,
java.lang.String internedName,
RubyModule object) |
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() |
java.lang.String[] |
getVariables() |
abstract boolean |
isArgumentScope()
Argument scopes represent scopes which contain arguments for zsuper.
|
boolean |
isBackrefLastlineScope() |
boolean |
isCaptured(int index) |
int |
isDefined(java.lang.String name)
Is this name in the visible to the current scope
|
protected abstract int |
isDefined(java.lang.String name,
int depth) |
abstract void |
makeArgumentScope() |
void |
setArities(int required,
int optional,
int rest) |
void |
setBackrefLastlineScope(boolean isBackrefLastlineScope) |
void |
setModule(RubyModule module) |
void |
setPreviousCRefScope(StaticScope crefScope) |
void |
setRequiredArgs(int requiredArgs) |
void |
setRestArg(int restArg) |
void |
setVariables(java.lang.String[] names) |
java.lang.String |
toString() |
protected final StaticScope enclosingScope
protected StaticScope(StaticScope enclosingScope, java.lang.String[] names)
enclosingScope
- The lexically containing scope.names
- The list of interned String variable names.public int addVariableThisScope(java.lang.String name)
name
- of new variablepublic int addVariable(java.lang.String name)
name
- of new variablepublic java.lang.String[] getVariables()
public int getNumberOfVariables()
public void setVariables(java.lang.String[] names)
public IRubyObject getConstantWithConstMissing(Ruby runtime, java.lang.String internedName, RubyModule object)
public IRubyObject getConstant(Ruby runtime, java.lang.String internedName, RubyModule object)
public StaticScope getEnclosingScope()
public int exists(java.lang.String name)
name
- of the variable to findpublic int isDefined(java.lang.String name)
name
- to be looked forpublic AssignableNode assign(ISourcePosition position, java.lang.String name, Node value)
position
- name
- value
- public abstract java.lang.String[] getAllNamesInScope()
protected abstract int isDefined(java.lang.String name, int depth)
protected abstract AssignableNode assign(ISourcePosition position, java.lang.String name, Node value, StaticScope topScope, int depth)
protected abstract Node declare(ISourcePosition position, java.lang.String name, int depth)
public Node declare(ISourcePosition position, java.lang.String name)
position
- the location that in the source that the new node will come fromname
- of the variable to be created is namedpublic void capture(int index)
public boolean isCaptured(int index)
public 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 isBackrefLastlineScope()
public void setBackrefLastlineScope(boolean isBackrefLastlineScope)
public Arity getArity()
public void setArities(int required, int optional, int rest)
public DynamicScope getDummyScope()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2002-2009 JRuby Team. All Rights Reserved.