Top Description Fields Constructors Methods
org.jruby.runtime.scope

public Class ManyVarsDynamicScope

extends DynamicScope
Class Inheritance
Imports
org.jruby.parser.StaticScope, org.jruby.runtime.DynamicScope, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ArraySupport, java.lang.invoke.MethodHandle, .MethodHandles, .MethodType

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

Modifier and TypeField and Description
public static final MethodHandle
private IRubyObject[]
Inherited from org.jruby.runtime.DynamicScope:
parentstaticScope

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private static boolean
checkOffset(IRubyObject[] variableValues, int offset)

public DynamicScope
private static String
failGet(ManyVarsDynamicScope scope, int offset)

private static String
failGet(ManyVarsDynamicScope scope, int offset, int depth)

private static String
failSet(ManyVarsDynamicScope scope, IRubyObject value, int offset)

public 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
)

Implements abstract org.jruby.runtime.DynamicScope.getValue.

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

public IRubyObject
getValueDepthZero(int offset)

Overrides org.jruby.runtime.DynamicScope.getValueDepthZero.

Variation of getValue for depth 0

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

Overrides org.jruby.runtime.DynamicScope.getValueOrNil.

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

public IRubyObject[]
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
public void
growIfNeeded()

Overrides org.jruby.runtime.DynamicScope.growIfNeeded.

Make a larger dynamic scope if the static scope grew.

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

Overrides org.jruby.runtime.DynamicScope.setValueDepthZeroVoid.

setValue for depth zero

public void
public void
public void
public void
public void
public void
public void
public void
public void
public 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
)

Implements abstract org.jruby.runtime.DynamicScope.setValueVoid.

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

public void
public void
setVariableValues(IRubyObject[] variableValues)

Inherited from org.jruby.runtime.DynamicScope:
clearEvalTypedupEvalScopegetAllNamesInScopegetEvalTypegetNextCapturedScopegetNthParentScopegetParentScopegetStaticScopegetValueEightDepthZerogetValueEightDepthZeroOrNilgetValueFiveDepthZerogetValueFiveDepthZeroOrNilgetValueFourDepthZerogetValueFourDepthZeroOrNilgetValueNineDepthZerogetValueNineDepthZeroOrNilgetValueSevenDepthZerogetValueSevenDepthZeroOrNilgetValueSixDepthZerogetValueSixDepthZeroOrNilinBindingEvalinInstanceEvalinModuleEvalisLambdaisReturnTargetnewDummyScopenewDynamicScopenewDynamicScopenewDynamicScopesetEvalTypesetLambdasetValuesetValuesetValueDepthZerosetValueOneDepthZerosetValueThreeDepthZerosetValueTwoDepthZerosetValueZeroDepthZerotoStringtoString

Field Detail

CONSTRUCTORback to summary
public static final MethodHandle CONSTRUCTOR
variableValuesback to summary
private IRubyObject[] variableValues

Constructor Detail

ManyVarsDynamicScopeback to summary
public ManyVarsDynamicScope(StaticScope staticScope, DynamicScope parent)

Method Detail

allocateback to summary
private void allocate()
checkOffsetback to summary
private static boolean checkOffset(IRubyObject[] variableValues, int offset)
cloneScopeback to summary
public DynamicScope cloneScope()

Overrides org.jruby.runtime.DynamicScope.cloneScope.

Deprecated

Annotations
@Deprecated
failGetback to summary
private static String failGet(ManyVarsDynamicScope scope, int offset)
failGetback to summary
private static String failGet(ManyVarsDynamicScope scope, int offset, int depth)
failSetback to summary
private static String failSet(ManyVarsDynamicScope scope, IRubyObject value, int offset)
getValueback to summary
public IRubyObject getValue(int offset, int depth)

Implements abstract org.jruby.runtime.DynamicScope.getValue.

Get value from current scope or one of its captured scopes. FIXME: block variables are not getting primed to nil so we need to null check those until we prime them properly. Also add assert back in.

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

getValueDepthZeroback to summary
public IRubyObject getValueDepthZero(int offset)

Overrides org.jruby.runtime.DynamicScope.getValueDepthZero.

Doc from org.jruby.runtime.DynamicScope.getValueDepthZero.

Variation of getValue for depth 0

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

Overrides org.jruby.runtime.DynamicScope.getValueDepthZeroOrNil.

Doc from org.jruby.runtime.DynamicScope.getValueDepthZeroOrNil.

getValueOrNil for depth 0

getValueOneDepthZeroback to summary
public IRubyObject getValueOneDepthZero()

Overrides org.jruby.runtime.DynamicScope.getValueOneDepthZero.

Doc from org.jruby.runtime.DynamicScope.getValueOneDepthZero.

getValue for index 1, depth 0

getValueOneDepthZeroOrNilback to summary
public IRubyObject getValueOneDepthZeroOrNil(IRubyObject nil)

Overrides org.jruby.runtime.DynamicScope.getValueOneDepthZeroOrNil.

Doc from org.jruby.runtime.DynamicScope.getValueOneDepthZeroOrNil.

getValueOrNil for index 1, depth 0

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

Overrides org.jruby.runtime.DynamicScope.getValueOrNil.

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

getValuesback to summary
public IRubyObject[] getValues()

Overrides org.jruby.runtime.DynamicScope.getValues.

getValueThreeDepthZeroback to summary
public IRubyObject getValueThreeDepthZero()

Overrides org.jruby.runtime.DynamicScope.getValueThreeDepthZero.

Doc from org.jruby.runtime.DynamicScope.getValueThreeDepthZero.

getValue for index 3, depth 0

getValueThreeDepthZeroOrNilback to summary
public IRubyObject getValueThreeDepthZeroOrNil(IRubyObject nil)

Overrides org.jruby.runtime.DynamicScope.getValueThreeDepthZeroOrNil.

Doc from org.jruby.runtime.DynamicScope.getValueThreeDepthZeroOrNil.

getValueOrNil for index 3, depth 0

getValueTwoDepthZeroback to summary
public IRubyObject getValueTwoDepthZero()

Overrides org.jruby.runtime.DynamicScope.getValueTwoDepthZero.

Doc from org.jruby.runtime.DynamicScope.getValueTwoDepthZero.

getValue for index 2, depth 0

getValueTwoDepthZeroOrNilback to summary
public IRubyObject getValueTwoDepthZeroOrNil(IRubyObject nil)

Overrides org.jruby.runtime.DynamicScope.getValueTwoDepthZeroOrNil.

Doc from org.jruby.runtime.DynamicScope.getValueTwoDepthZeroOrNil.

getValueOrNil for index 2, depth 0

getValueZeroDepthZeroback to summary
public IRubyObject getValueZeroDepthZero()

Overrides org.jruby.runtime.DynamicScope.getValueZeroDepthZero.

Doc from org.jruby.runtime.DynamicScope.getValueZeroDepthZero.

getValue for index 0, depth 0

getValueZeroDepthZeroOrNilback to summary
public IRubyObject getValueZeroDepthZeroOrNil(IRubyObject nil)

Overrides org.jruby.runtime.DynamicScope.getValueZeroDepthZeroOrNil.

Doc from org.jruby.runtime.DynamicScope.getValueZeroDepthZeroOrNil.

getValueOrNil for index 0, depth 0

growIfNeededback to summary
public void growIfNeeded()

Overrides org.jruby.runtime.DynamicScope.growIfNeeded.

Make a larger dynamic scope if the static scope grew. Eval's with bindings require us to possibly change the size of the dynamic scope if things like 'eval "b = 2", binding' happens.

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

Overrides org.jruby.runtime.DynamicScope.setValueDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueDepthZeroVoid.

setValue for depth zero

Parameters
value:IRubyObject

to set

offset:int

zero-indexed value that represents where variable lives

setValueEightDepthZeroVoidback to summary
public void setValueEightDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueEightDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueEightDepthZeroVoid.

Set value eight in this scope.

setValueFiveDepthZeroVoidback to summary
public void setValueFiveDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueFiveDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueFiveDepthZeroVoid.

Set value five in this scope.

setValueFourDepthZeroVoidback to summary
public void setValueFourDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueFourDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueFourDepthZeroVoid.

Set value four in this scope.

setValueNineDepthZeroVoidback to summary
public void setValueNineDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueNineDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueNineDepthZeroVoid.

Set value nine in this scope.

setValueOneDepthZeroVoidback to summary
public void setValueOneDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueOneDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueOneDepthZeroVoid.

Set value one in this scope.

setValueSevenDepthZeroVoidback to summary
public void setValueSevenDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueSevenDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueSevenDepthZeroVoid.

Set value seven in this scope.

setValueSixDepthZeroVoidback to summary
public void setValueSixDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueSixDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueSixDepthZeroVoid.

Set value six in this scope.

setValueThreeDepthZeroVoidback to summary
public void setValueThreeDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueThreeDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueThreeDepthZeroVoid.

Set value three in this scope.

setValueTwoDepthZeroVoidback to summary
public void setValueTwoDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueTwoDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueTwoDepthZeroVoid.

Set value two in this scope.

setValueVoidback to summary
public void setValueVoid(IRubyObject value, int offset, int depth)

Implements abstract org.jruby.runtime.DynamicScope.setValueVoid.

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

setValueZeroDepthZeroVoidback to summary
public void setValueZeroDepthZeroVoid(IRubyObject value)

Overrides org.jruby.runtime.DynamicScope.setValueZeroDepthZeroVoid.

Doc from org.jruby.runtime.DynamicScope.setValueZeroDepthZeroVoid.

Set value zero in this scope;

setVariableValuesback to summary
public void setVariableValues(IRubyObject[] variableValues)