Top Fields Constructors Methods
org.jruby.runtime

public abstract Class DynamicScope

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
org.jruby.runtime.scope.ManyVarsDynamicScope
Imports
org.jruby.EvalType, org.jruby.ir.IRScopeType, .JIT, org.jruby.parser.StaticScope, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.scope.ManyVarsDynamicScope

Field Summary

Modifier and TypeField and Description
private EvalType
private boolean
protected final DynamicScope
protected final StaticScope

Constructor Summary

AccessConstructor and Description
protected
DynamicScope(StaticScope staticScope, DynamicScope parent)

Method Summary

Modifier and TypeMethod and Description
public void
public DynamicScope
cloneScope()
Deprecated

public DynamicScope

Returns:

a duplicate of this scope with all the current values
dupEvalScope
()

Binding needs to clone its scope with all the current values.

public final String[]

Returns:

a list of variable names
getAllNamesInScope
()

Get all variable names captured (visible) by this scope (sans $~ and $_).

public EvalType
public DynamicScope
getNextCapturedScope()
Deprecated

public DynamicScope

Returns:

The n-th parent scope or null.
getNthParentScope
(int
- number of levels above to look.
n
)

Returns the n-th parent scope of this scope.

public final DynamicScope
getParentScope()

Get parent (capturing) scope.

public final StaticScope

Returns:

static complement to this scope
getStaticScope
()

Get the static scope associated with this DynamicScope.

public abstract IRubyObject

Returns:

the value here
getValue
(int
zero-indexed value that represents where variable lives
offset
,
int
how many captured scopes down this variable should be set
depth
)

Get value from current scope or one of its captured scopes.

public IRubyObject
getValueDepthZero(int offset)

Variation of getValue for depth 0

public IRubyObject
getValueDepthZeroOrNil(int offset, IRubyObject nil)

getValueOrNil for depth 0

public IRubyObject
getValueEightDepthZero()

getValue for index 8, depth 0

public IRubyObject
getValueEightDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 8, depth 0

public IRubyObject
getValueFiveDepthZero()

getValue for index 5, depth 0

public IRubyObject
getValueFiveDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 5, depth 0

public IRubyObject
getValueFourDepthZero()

getValue for index 4, depth 0

public IRubyObject
getValueFourDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 4, depth 0

public IRubyObject
getValueNineDepthZero()

getValue for index 9, depth 0

public IRubyObject
getValueNineDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 9, depth 0

public IRubyObject
getValueOneDepthZero()

getValue for index 1, depth 0

public IRubyObject
getValueOneDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 1, depth 0

public IRubyObject
getValueOrNil(int offset, int depth, IRubyObject nil)

Variation of getValue that checks for nulls, returning and setting the given value (presumably nil)

public IRubyObject[]
public IRubyObject
getValueSevenDepthZero()

getValue for index 7, depth 0

public IRubyObject
getValueSevenDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 7, depth 0

public IRubyObject
getValueSixDepthZero()

getValue for index 6, depth 0

public IRubyObject
getValueSixDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 6, depth 0

public IRubyObject
getValueThreeDepthZero()

getValue for index 3, depth 0

public IRubyObject
getValueThreeDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 3, depth 0

public IRubyObject
getValueTwoDepthZero()

getValue for index 2, depth 0

public IRubyObject
getValueTwoDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 2, depth 0

public IRubyObject
getValueZeroDepthZero()

getValue for index 0, depth 0

public IRubyObject
getValueZeroDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 0, depth 0

public void
public boolean
public boolean
public boolean
public boolean
public boolean

Returns:

true if this scope is the nearest return scope, false otherwise
isReturnTarget
()

A DynamicScope is the target of a non-local return if it is one of the following: * A method scope * A top-level script scope * A block scope that is either marked as the argument scope (define_method) or a lambda

public static DynamicScope
newDummyScope(StaticScope staticScope, DynamicScope parent)

public static DynamicScope
public static DynamicScope
newDynamicScope(StaticScope staticScope, DynamicScope parent, EvalType evalType)

public static DynamicScope
public void
public void
setLambda(boolean lambda)

public IRubyObject
setValue(int
zero-indexed value that represents where variable lives
offset
,
IRubyObject
to set
value
,
int
how many captured scopes down this variable should be set
depth
)

Set value in current dynamic scope or one of its captured scopes.

public IRubyObject
setValue(IRubyObject
to set
value
,
int
zero-indexed value that represents where variable lives
offset
,
int
how many captured scopes down this variable should be set
depth
)

Set value in current dynamic scope or one of its captured scopes.

public IRubyObject
setValueDepthZero(IRubyObject
to set
value
,
int
zero-indexed value that represents where variable lives
offset
)

setValue for depth zero

public void
setValueDepthZeroVoid(IRubyObject
to set
value
,
int
zero-indexed value that represents where variable lives
offset
)

setValue for depth zero

public void
setValueEightDepthZeroVoid(IRubyObject value)

Set value eight in this scope.

public void
setValueFiveDepthZeroVoid(IRubyObject value)

Set value five in this scope.

public void
setValueFourDepthZeroVoid(IRubyObject value)

Set value four in this scope.

public void
setValueNineDepthZeroVoid(IRubyObject value)

Set value nine in this scope.

public IRubyObject
setValueOneDepthZero(IRubyObject value)

Set value one in this scope.

public void
setValueOneDepthZeroVoid(IRubyObject value)

Set value one in this scope.

public void
setValueSevenDepthZeroVoid(IRubyObject value)

Set value seven in this scope.

public void
setValueSixDepthZeroVoid(IRubyObject value)

Set value six in this scope.

public IRubyObject
setValueThreeDepthZero(IRubyObject value)

Set value three in this scope.

public void
setValueThreeDepthZeroVoid(IRubyObject value)

Set value three in this scope.

public IRubyObject
setValueTwoDepthZero(IRubyObject value)

Set value two in this scope.

public void
setValueTwoDepthZeroVoid(IRubyObject value)

Set value two in this scope.

public abstract void
setValueVoid(IRubyObject
to set
value
,
int
zero-indexed value that represents where variable lives
offset
,
int
how many captured scopes down this variable should be set
depth
)

Set value in current dynamic scope or one of its captured scopes.

public IRubyObject
setValueZeroDepthZero(IRubyObject value)

Set value zero in this scope;

public void
setValueZeroDepthZeroVoid(IRubyObject value)

Set value zero in this scope;

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

evalTypeback to summary
private EvalType evalType
lambdaback to summary
private boolean lambda
parentback to summary
protected final DynamicScope parent
staticScopeback to summary
protected final StaticScope staticScope

Constructor Detail

DynamicScopeback to summary
protected DynamicScope(StaticScope staticScope, DynamicScope parent)

Method Detail

clearEvalTypeback to summary
public void clearEvalType()
cloneScopeback to summary
public DynamicScope cloneScope()

Deprecated

Annotations
@Deprecated
dupEvalScopeback to summary
public DynamicScope dupEvalScope()

Binding needs to clone its scope with all the current values.

Returns:DynamicScope

a duplicate of this scope with all the current values

getAllNamesInScopeback to summary
public final String[] getAllNamesInScope()

Get all variable names captured (visible) by this scope (sans $~ and $_).

Returns:String[]

a list of variable names

getEvalTypeback to summary
public EvalType getEvalType()
getNextCapturedScopeback to summary
public DynamicScope getNextCapturedScope()

Deprecated

Annotations
@Deprecated
getNthParentScopeback to summary
public DynamicScope getNthParentScope(int n)

Returns the n-th parent scope of this scope. May return null.

Parameters
n:int

- number of levels above to look.

Returns:DynamicScope

The n-th parent scope or null.

getParentScopeback to summary
public final DynamicScope getParentScope()

Get parent (capturing) scope. This is used by eval and closures to walk up to hard lexical boundary.

getStaticScopeback to summary
public final StaticScope getStaticScope()

Get the static scope associated with this DynamicScope.

Returns:StaticScope

static complement to this scope

getValueback to summary
public abstract IRubyObject getValue(int offset, int depth)

Get value from current scope or one of its captured scopes.

Parameters
offset:int

zero-indexed value that represents where variable lives

depth:int

how many captured scopes down this variable should be set

Returns:IRubyObject

the value here

Annotations
@JIT
getValueDepthZeroback to summary
public IRubyObject getValueDepthZero(int offset)

Variation of getValue for depth 0

Annotations
@JIT
getValueDepthZeroOrNilback to summary
public IRubyObject getValueDepthZeroOrNil(int offset, IRubyObject nil)

getValueOrNil for depth 0

getValueEightDepthZeroback to summary
public IRubyObject getValueEightDepthZero()

getValue for index 8, depth 0

Annotations
@JIT
getValueEightDepthZeroOrNilback to summary
public IRubyObject getValueEightDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 8, depth 0

getValueFiveDepthZeroback to summary
public IRubyObject getValueFiveDepthZero()

getValue for index 5, depth 0

Annotations
@JIT
getValueFiveDepthZeroOrNilback to summary
public IRubyObject getValueFiveDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 5, depth 0

getValueFourDepthZeroback to summary
public IRubyObject getValueFourDepthZero()

getValue for index 4, depth 0

Annotations
@JIT
getValueFourDepthZeroOrNilback to summary
public IRubyObject getValueFourDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 4, depth 0

getValueNineDepthZeroback to summary
public IRubyObject getValueNineDepthZero()

getValue for index 9, depth 0

Annotations
@JIT
getValueNineDepthZeroOrNilback to summary
public IRubyObject getValueNineDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 9, depth 0

getValueOneDepthZeroback to summary
public IRubyObject getValueOneDepthZero()

getValue for index 1, depth 0

Annotations
@JIT
getValueOneDepthZeroOrNilback to summary
public IRubyObject getValueOneDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 1, depth 0

getValueOrNilback to summary
public IRubyObject getValueOrNil(int offset, int depth, IRubyObject nil)

Variation of getValue that checks for nulls, returning and setting the given value (presumably nil)

getValuesback to summary
public IRubyObject[] getValues()
getValueSevenDepthZeroback to summary
public IRubyObject getValueSevenDepthZero()

getValue for index 7, depth 0

Annotations
@JIT
getValueSevenDepthZeroOrNilback to summary
public IRubyObject getValueSevenDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 7, depth 0

getValueSixDepthZeroback to summary
public IRubyObject getValueSixDepthZero()

getValue for index 6, depth 0

Annotations
@JIT
getValueSixDepthZeroOrNilback to summary
public IRubyObject getValueSixDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 6, depth 0

getValueThreeDepthZeroback to summary
public IRubyObject getValueThreeDepthZero()

getValue for index 3, depth 0

Annotations
@JIT
getValueThreeDepthZeroOrNilback to summary
public IRubyObject getValueThreeDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 3, depth 0

getValueTwoDepthZeroback to summary
public IRubyObject getValueTwoDepthZero()

getValue for index 2, depth 0

Annotations
@JIT
getValueTwoDepthZeroOrNilback to summary
public IRubyObject getValueTwoDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 2, depth 0

getValueZeroDepthZeroback to summary
public IRubyObject getValueZeroDepthZero()

getValue for index 0, depth 0

Annotations
@JIT
getValueZeroDepthZeroOrNilback to summary
public IRubyObject getValueZeroDepthZeroOrNil(IRubyObject nil)

getValueOrNil for index 0, depth 0

growIfNeededback to summary
public void growIfNeeded()
inBindingEvalback to summary
public boolean inBindingEval()
inInstanceEvalback to summary
public boolean inInstanceEval()
inModuleEvalback to summary
public boolean inModuleEval()
isLambdaback to summary
public boolean isLambda()
isReturnTargetback to summary
public boolean isReturnTarget()

A DynamicScope is the target of a non-local return if it is one of the following: * A method scope * A top-level script scope * A block scope that is either marked as the argument scope (define_method) or a lambda

Returns:boolean

true if this scope is the nearest return scope, false otherwise

newDummyScopeback to summary
public static DynamicScope newDummyScope(StaticScope staticScope, DynamicScope parent)
newDynamicScopeback to summary
public static DynamicScope newDynamicScope(StaticScope staticScope, DynamicScope parent)
newDynamicScopeback to summary
public static DynamicScope newDynamicScope(StaticScope staticScope, DynamicScope parent, EvalType evalType)
newDynamicScopeback to summary
public static DynamicScope newDynamicScope(StaticScope staticScope)
setEvalTypeback to summary
public void setEvalType(EvalType evalType)
setLambdaback to summary
public void setLambda(boolean lambda)
setValueback to summary
public IRubyObject setValue(int offset, IRubyObject value, int depth)

Set value in current dynamic scope or one of its captured scopes.

Parameters
offset:int

zero-indexed value that represents where variable lives

value:IRubyObject

to set

depth:int

how many captured scopes down this variable should be set

setValueback to summary
public IRubyObject setValue(IRubyObject value, int offset, int depth)

Set value in current dynamic scope or one of its captured scopes.

Parameters
value:IRubyObject

to set

offset:int

zero-indexed value that represents where variable lives

depth:int

how many captured scopes down this variable should be set

setValueDepthZeroback to summary
public IRubyObject setValueDepthZero(IRubyObject value, int offset)

setValue for depth zero

Parameters
value:IRubyObject

to set

offset:int

zero-indexed value that represents where variable lives

setValueDepthZeroVoidback to summary
public void setValueDepthZeroVoid(IRubyObject value, int offset)

setValue for depth zero

Parameters
value:IRubyObject

to set

offset:int

zero-indexed value that represents where variable lives

Annotations
@JIT
setValueEightDepthZeroVoidback to summary
public void setValueEightDepthZeroVoid(IRubyObject value)

Set value eight in this scope.

Annotations
@JIT
setValueFiveDepthZeroVoidback to summary
public void setValueFiveDepthZeroVoid(IRubyObject value)

Set value five in this scope.

Annotations
@JIT
setValueFourDepthZeroVoidback to summary
public void setValueFourDepthZeroVoid(IRubyObject value)

Set value four in this scope.

Annotations
@JIT
setValueNineDepthZeroVoidback to summary
public void setValueNineDepthZeroVoid(IRubyObject value)

Set value nine in this scope.

Annotations
@JIT
setValueOneDepthZeroback to summary
public IRubyObject setValueOneDepthZero(IRubyObject value)

Set value one in this scope.

setValueOneDepthZeroVoidback to summary
public void setValueOneDepthZeroVoid(IRubyObject value)

Set value one in this scope.

Annotations
@JIT
setValueSevenDepthZeroVoidback to summary
public void setValueSevenDepthZeroVoid(IRubyObject value)

Set value seven in this scope.

Annotations
@JIT
setValueSixDepthZeroVoidback to summary
public void setValueSixDepthZeroVoid(IRubyObject value)

Set value six in this scope.

Annotations
@JIT
setValueThreeDepthZeroback to summary
public IRubyObject setValueThreeDepthZero(IRubyObject value)

Set value three in this scope.

setValueThreeDepthZeroVoidback to summary
public void setValueThreeDepthZeroVoid(IRubyObject value)

Set value three in this scope.

Annotations
@JIT
setValueTwoDepthZeroback to summary
public IRubyObject setValueTwoDepthZero(IRubyObject value)

Set value two in this scope.

setValueTwoDepthZeroVoidback to summary
public void setValueTwoDepthZeroVoid(IRubyObject value)

Set value two in this scope.

Annotations
@JIT
setValueVoidback to summary
public abstract void setValueVoid(IRubyObject value, int offset, int depth)

Set value in current dynamic scope or one of its captured scopes.

Parameters
value:IRubyObject

to set

offset:int

zero-indexed value that represents where variable lives

depth:int

how many captured scopes down this variable should be set

Annotations
@JIT
setValueZeroDepthZeroback to summary
public IRubyObject setValueZeroDepthZero(IRubyObject value)

Set value zero in this scope;

setValueZeroDepthZeroVoidback to summary
public void setValueZeroDepthZeroVoid(IRubyObject value)

Set value zero in this scope;

Annotations
@JIT
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
toStringback to summary
public String toString(StringBuffer buf, String indent)