|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.runtime.DynamicScope
org.jruby.runtime.scope.ManyVarsDynamicScope
public class ManyVarsDynamicScope
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
Field Summary |
---|
Fields inherited from class org.jruby.runtime.DynamicScope |
---|
evalScope, parent, staticScope |
Constructor Summary | |
---|---|
ManyVarsDynamicScope(StaticScope staticScope)
|
|
ManyVarsDynamicScope(StaticScope staticScope,
DynamicScope parent)
|
Method Summary | |
---|---|
DynamicScope |
cloneScope()
|
IRubyObject[] |
getArgValues()
Copy variable values back for ZSuper call. |
IRubyObject |
getValue(int offset,
int depth)
Get value from current scope or one of its captured scopes. |
IRubyObject |
getValueDepthZeroOrNil(int offset,
IRubyObject nil)
getValueOrNil for depth 0 |
IRubyObject |
getValueOneDepthZeroOrNil(IRubyObject nil)
getValueOrNil for index 1, depth 0 |
IRubyObject |
getValueOrNil(int offset,
int depth,
IRubyObject nil)
Variation of getValue that checks for nulls, returning and setting the given value (presumably nil) |
IRubyObject[] |
getValues()
|
IRubyObject |
getValueZeroDepthZeroOrNil(IRubyObject nil)
getValueOrNil for index 0, depth 0 |
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 |
setValue(int offset,
IRubyObject value,
int depth)
Set value in current dynamic scope or one of its captured scopes. |
void |
setValueDepthZero(IRubyObject value,
int offset)
setValue for depth zero |
void |
setValueOneDepthZero(IRubyObject value)
Set value in current dynamic scope or one of its captured scopes. |
void |
setValueZeroDepthZero(IRubyObject value)
Set value in current dynamic scope or one of its captured scopes. |
java.lang.String |
toString(java.lang.StringBuffer buf,
java.lang.String indent)
|
Methods inherited from class org.jruby.runtime.DynamicScope |
---|
getAllNamesInScope, getEvalScope, getNextCapturedScope, getNthParentScope, getStaticScope, newDynamicScope, newDynamicScope, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ManyVarsDynamicScope(StaticScope staticScope, DynamicScope parent)
public ManyVarsDynamicScope(StaticScope staticScope)
Method Detail |
---|
public DynamicScope cloneScope()
cloneScope
in class DynamicScope
public IRubyObject[] getValues()
getValues
in class DynamicScope
public IRubyObject getValue(int offset, int depth)
getValue
in class DynamicScope
offset
- zero-indexed value that represents where variable livesdepth
- how many captured scopes down this variable should be set
public IRubyObject getValueOrNil(int offset, int depth, IRubyObject nil)
getValueOrNil
in class DynamicScope
public IRubyObject getValueDepthZeroOrNil(int offset, IRubyObject nil)
DynamicScope
getValueDepthZeroOrNil
in class DynamicScope
public IRubyObject getValueZeroDepthZeroOrNil(IRubyObject nil)
DynamicScope
getValueZeroDepthZeroOrNil
in class DynamicScope
public IRubyObject getValueOneDepthZeroOrNil(IRubyObject nil)
DynamicScope
getValueOneDepthZeroOrNil
in class DynamicScope
public void setValue(int offset, IRubyObject value, int depth)
setValue
in class DynamicScope
offset
- zero-indexed value that represents where variable livesvalue
- to setdepth
- how many captured scopes down this variable should be setpublic void setValueDepthZero(IRubyObject value, int offset)
DynamicScope
setValueDepthZero
in class DynamicScope
value
- to setoffset
- zero-indexed value that represents where variable livespublic void setValueZeroDepthZero(IRubyObject value)
DynamicScope
setValueZeroDepthZero
in class DynamicScope
value
- to setpublic void setValueOneDepthZero(IRubyObject value)
DynamicScope
setValueOneDepthZero
in class DynamicScope
value
- to setpublic void setArgValues(IRubyObject[] values, int size)
setArgValues
in class DynamicScope
values
- up to size specified to be mapped as ordinary parm valuessize
- is the number of values to assign as ordinary parm valuespublic IRubyObject[] getArgValues()
getArgValues
in class DynamicScope
public void growIfNeeded()
growIfNeeded
in class DynamicScope
public java.lang.String toString(java.lang.StringBuffer buf, java.lang.String indent)
toString
in class DynamicScope
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |