|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.runtime.DynamicScope
public class DynamicScope
Represents the the dynamic portion of scoping information. The variableValues are the values of assigned local or block variables. The staticScope identifies which sort of scope this is (block or local). Properties of Dynamic Scopes: 1. static and dynamic scopes have the same number of names to values 2. size of variables (and thus names) is determined during parsing. So those structured do not need to change FIXME: When creating dynamic scopes we sometimes accidentally pass in extra parents. This is harmless (other than wasting memory), but we should not do that. We can fix this in two ways: 1. Fix all callers 2. Check parent that is passed in and make if new instance is local, then its parent is not local
Constructor Summary | |
---|---|
DynamicScope(StaticScope staticScope)
|
|
DynamicScope(StaticScope staticScope,
DynamicScope parent)
|
Method Summary | |
---|---|
DynamicScope |
cloneScope()
|
java.lang.String[] |
getAllNamesInScope()
Get all variable names captured (visible) by this scope (sans $~ and $_). |
void |
getArgValues(IRubyObject[] args,
int size)
Copy variable values back for ZSuper call. |
IRubyObject |
getBackRef()
|
DynamicScope |
getBindingScope()
|
IRubyObject |
getLastLine()
|
DynamicScope |
getNextCapturedScope()
Get next 'captured' scope. |
StaticScope |
getStaticScope()
Get the static scope associated with this DynamicScope. |
IRubyObject |
getValue(int offset,
int depth)
Get value from current scope or one of its captured scopes. |
IRubyObject[] |
getValues()
|
void |
growIfNeeded()
Make a larger dynamic scope if the static scope grew. |
void |
setArgValues(IRubyObject[] values,
int size)
Set all values which represent 'normal' parameters in a call list to this dynamic scope. |
void |
setBackRef(IRubyObject value)
|
void |
setBindingScope(DynamicScope bindingScope)
|
void |
setBlockArgValues(IRubyObject[] blockArgValues,
int size)
|
void |
setLastLine(IRubyObject value)
|
void |
setValue(int offset,
IRubyObject value,
int depth)
Set value in current dynamic scope or one of its captured scopes. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DynamicScope(StaticScope staticScope, DynamicScope parent)
public DynamicScope(StaticScope staticScope)
Method Detail |
---|
public DynamicScope cloneScope()
public java.lang.String[] getAllNamesInScope()
public IRubyObject[] getValues()
public IRubyObject getValue(int offset, int depth)
offset
- zero-indexed value that represents where variable livesdepth
- how many captured scopes down this variable should be set
public void setValue(int offset, IRubyObject value, int depth)
offset
- zero-indexed value that represents where variable livesvalue
- to setdepth
- how many captured scopes down this variable should be setpublic void setArgValues(IRubyObject[] values, int size)
values
- up to size specified to be mapped as ordinary parm valuessize
- is the number of values to assign as ordinary parm valuespublic void setBlockArgValues(IRubyObject[] blockArgValues, int size)
public void getArgValues(IRubyObject[] args, int size)
public void growIfNeeded()
public void setLastLine(IRubyObject value)
public IRubyObject getLastLine()
public void setBackRef(IRubyObject value)
public IRubyObject getBackRef()
public DynamicScope getBindingScope()
public void setBindingScope(DynamicScope bindingScope)
public DynamicScope getNextCapturedScope()
public StaticScope getStaticScope()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |