@@ -853,7 +853,7 @@ public RubyNode visitCaseNode(CaseParseNode node) {
853
853
// Evaluate the case expression and store it in a local
854
854
855
855
final String tempName = environment .allocateLocalTemp ("case" );
856
- final ReadLocalNode readTemp = environment .findLocalVarNode (tempName , source , sourceSection );
856
+ final ReadLocalNode readTemp = environment .findLocalVarNode (tempName , sourceSection );
857
857
final RubyNode assignTemp = readTemp .makeWriteNode (node .getCaseNode ().accept (this ));
858
858
859
859
/*
@@ -1218,7 +1218,7 @@ private RubyNode translateInterpolatedString(SourceIndexLength sourceSection, Pa
1218
1218
@ Override
1219
1219
public RubyNode visitDVarNode (DVarParseNode node ) {
1220
1220
final String name = node .getName ();
1221
- RubyNode readNode = environment .findLocalVarNode (name , source , node .getPosition ());
1221
+ RubyNode readNode = environment .findLocalVarNode (name , node .getPosition ());
1222
1222
1223
1223
if (readNode == null ) {
1224
1224
// If we haven't seen this dvar before it's possible that it's a block local variable
@@ -1237,7 +1237,7 @@ public RubyNode visitDVarNode(DVarParseNode node) {
1237
1237
// the variable should be declared in a parent frame descriptor. This is so the search can determine
1238
1238
// whether to return a ReadLocalVariableNode or a ReadDeclarationVariableNode and potentially record the
1239
1239
// fact that a declaration frame is needed.
1240
- readNode = environment .findLocalVarNode (name , source , node .getPosition ());
1240
+ readNode = environment .findLocalVarNode (name , node .getPosition ());
1241
1241
}
1242
1242
1243
1243
return addNewlineIfNeeded (node , readNode );
@@ -1795,7 +1795,7 @@ public RubyNode visitLocalAsgnNode(LocalAsgnParseNode node) {
1795
1795
environment .declareVar (name );
1796
1796
}
1797
1797
1798
- ReadLocalNode lhs = environment .findLocalVarNode (name , source , sourceSection );
1798
+ ReadLocalNode lhs = environment .findLocalVarNode (name , sourceSection );
1799
1799
1800
1800
if (lhs == null ) {
1801
1801
TranslatorEnvironment environmentToDeclareIn = environment ;
@@ -1804,7 +1804,7 @@ public RubyNode visitLocalAsgnNode(LocalAsgnParseNode node) {
1804
1804
}
1805
1805
environmentToDeclareIn .declareVar (name );
1806
1806
1807
- lhs = environment .findLocalVarNode (name , source , sourceSection );
1807
+ lhs = environment .findLocalVarNode (name , sourceSection );
1808
1808
1809
1809
if (lhs == null ) {
1810
1810
throw new RuntimeException ("shouldn't be here" );
@@ -1831,7 +1831,7 @@ public RubyNode visitLocalVarNode(LocalVarParseNode node) {
1831
1831
1832
1832
final String name = node .getName ();
1833
1833
1834
- RubyNode readNode = environment .findLocalVarNode (name , source , sourceSection );
1834
+ RubyNode readNode = environment .findLocalVarNode (name , sourceSection );
1835
1835
1836
1836
if (readNode == null ) {
1837
1837
/*
@@ -1846,7 +1846,7 @@ def destructure4r((*c,d))
1846
1846
*/
1847
1847
1848
1848
environment .declareVar (name );
1849
- readNode = environment .findLocalVarNode (name , source , sourceSection );
1849
+ readNode = environment .findLocalVarNode (name , sourceSection );
1850
1850
}
1851
1851
1852
1852
return addNewlineIfNeeded (node , readNode );
@@ -1897,7 +1897,7 @@ public RubyNode visitMatch2Node(Match2ParseNode node) {
1897
1897
setters [n ] = match2NonNilSetter (node , name , tempVar );
1898
1898
}
1899
1899
final RubyNode readNode = ReadGlobalVariableNodeGen .create ("$~" );
1900
- ReadLocalNode tempVarReadNode = environment .findLocalVarNode (tempVar , source , node .getPosition ());
1900
+ ReadLocalNode tempVarReadNode = environment .findLocalVarNode (tempVar , node .getPosition ());
1901
1901
RubyNode readMatchNode = tempVarReadNode .makeWriteNode (readNode );
1902
1902
ret = new ReadMatchReferenceNodes .SetNamedVariablesMatchNode (ret , readMatchNode , setters , nilSetters );
1903
1903
}
@@ -1907,12 +1907,12 @@ public RubyNode visitMatch2Node(Match2ParseNode node) {
1907
1907
}
1908
1908
1909
1909
private RubyNode match2NilSetter (ParseNode node , String name ) {
1910
- return environment .findLocalVarNode (name , source , node .getPosition ()).makeWriteNode (new NilLiteralNode (true ));
1910
+ return environment .findLocalVarNode (name , node .getPosition ()).makeWriteNode (new NilLiteralNode (true ));
1911
1911
}
1912
1912
1913
1913
private RubyNode match2NonNilSetter (ParseNode node , String name , String tempVar ) {
1914
- ReadLocalNode varNode = environment .findLocalVarNode (name , source , node .getPosition ());
1915
- ReadLocalNode tempVarNode = environment .findLocalVarNode (tempVar , source , node .getPosition ());
1914
+ ReadLocalNode varNode = environment .findLocalVarNode (name , node .getPosition ());
1915
+ ReadLocalNode tempVarNode = environment .findLocalVarNode (tempVar , node .getPosition ());
1916
1916
ObjectLiteralNode symbolNode = new ObjectLiteralNode (context .getSymbolTable ().getSymbol (name ));
1917
1917
GetIndexNode getIndexNode = GetIndexNode .create (tempVarNode , symbolNode , new ObjectLiteralNode (NotProvided .INSTANCE ));
1918
1918
return varNode .makeWriteNode (getIndexNode );
@@ -1996,7 +1996,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
1996
1996
1997
1997
for (int n = 0 ; n < assignedValuesCount ; n ++) {
1998
1998
final String tempName = environment .allocateLocalTemp ("multi" );
1999
- final ReadLocalNode readTemp = environment .findLocalVarNode (tempName , source , sourceSection );
1999
+ final ReadLocalNode readTemp = environment .findLocalVarNode (tempName , sourceSection );
2000
2000
final RubyNode assignTemp = readTemp .makeWriteNode (rhsArrayLiteral .stealNode (n ));
2001
2001
final RubyNode assignFinalValue = translateDummyAssignment (preArray .get (n ), NodeUtil .cloneNode (readTemp ));
2002
2002
@@ -2041,7 +2041,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2041
2041
*/
2042
2042
2043
2043
final String tempRHSName = environment .allocateLocalTemp ("rhs" );
2044
- final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , source , sourceSection ).makeWriteNode (rhsTranslated );
2044
+ final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , sourceSection ).makeWriteNode (rhsTranslated );
2045
2045
sequence .add (writeTempRHS );
2046
2046
2047
2047
/*
@@ -2055,10 +2055,10 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2055
2055
* the temp.
2056
2056
*/
2057
2057
2058
- final RubyNode splatCastNode = SplatCastNodeGen .create (translatingNextExpression ? SplatCastNode .NilBehavior .EMPTY_ARRAY : SplatCastNode .NilBehavior .ARRAY_WITH_NIL , true , environment .findLocalVarNode (tempRHSName , source , sourceSection ));
2058
+ final RubyNode splatCastNode = SplatCastNodeGen .create (translatingNextExpression ? SplatCastNode .NilBehavior .EMPTY_ARRAY : SplatCastNode .NilBehavior .ARRAY_WITH_NIL , true , environment .findLocalVarNode (tempRHSName , sourceSection ));
2059
2059
splatCastNode .unsafeSetSourceSection (sourceSection );
2060
2060
2061
- final RubyNode writeTemp = environment .findLocalVarNode (tempName , source , sourceSection ).makeWriteNode (splatCastNode );
2061
+ final RubyNode writeTemp = environment .findLocalVarNode (tempName , sourceSection ).makeWriteNode (splatCastNode );
2062
2062
2063
2063
sequence .add (writeTemp );
2064
2064
@@ -2067,13 +2067,13 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2067
2067
*/
2068
2068
2069
2069
for (int n = 0 ; n < preArray .size (); n ++) {
2070
- final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , source , sourceSection ), n );
2070
+ final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , sourceSection ), n );
2071
2071
2072
2072
sequence .add (translateDummyAssignment (preArray .get (n ), assignedValue ));
2073
2073
}
2074
2074
2075
2075
if (node .getRest () != null ) {
2076
- RubyNode assignedValue = ArrayGetTailNodeGen .create (preArray .size (), environment .findLocalVarNode (tempName , source , sourceSection ));
2076
+ RubyNode assignedValue = ArrayGetTailNodeGen .create (preArray .size (), environment .findLocalVarNode (tempName , sourceSection ));
2077
2077
2078
2078
if (postArray != null ) {
2079
2079
assignedValue = ArrayDropTailNodeGen .create (postArray .size (), assignedValue );
@@ -2086,7 +2086,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2086
2086
final List <RubyNode > smallerSequence = new ArrayList <>();
2087
2087
2088
2088
for (int n = 0 ; n < postArray .size (); n ++) {
2089
- final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , source , sourceSection ), node .getPreCount () + n );
2089
+ final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , sourceSection ), node .getPreCount () + n );
2090
2090
smallerSequence .add (translateDummyAssignment (postArray .get (n ), assignedValue ));
2091
2091
}
2092
2092
@@ -2095,7 +2095,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2095
2095
final List <RubyNode > atLeastAsLargeSequence = new ArrayList <>();
2096
2096
2097
2097
for (int n = 0 ; n < postArray .size (); n ++) {
2098
- final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , source , sourceSection ), -(postArray .size () - n ));
2098
+ final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , sourceSection ), -(postArray .size () - n ));
2099
2099
2100
2100
atLeastAsLargeSequence .add (translateDummyAssignment (postArray .get (n ), assignedValue ));
2101
2101
}
@@ -2104,14 +2104,14 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2104
2104
2105
2105
final RubyNode assignPost =
2106
2106
new IfElseNode (
2107
- new ArrayIsAtLeastAsLargeAsNode (node .getPreCount () + node .getPostCount (), environment .findLocalVarNode (tempName , source , sourceSection )),
2107
+ new ArrayIsAtLeastAsLargeAsNode (node .getPreCount () + node .getPostCount (), environment .findLocalVarNode (tempName , sourceSection )),
2108
2108
atLeastAsLarge ,
2109
2109
smaller );
2110
2110
2111
2111
sequence .add (assignPost );
2112
2112
}
2113
2113
2114
- result = new ElidableResultNode (sequence (sourceSection , sequence ), environment .findLocalVarNode (tempRHSName , source , sourceSection ));
2114
+ result = new ElidableResultNode (sequence (sourceSection , sequence ), environment .findLocalVarNode (tempRHSName , sourceSection ));
2115
2115
} else if (node .getPre () == null
2116
2116
&& node .getPost () == null
2117
2117
&& node .getRest () instanceof StarParseNode ) {
@@ -2145,27 +2145,27 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2145
2145
}
2146
2146
2147
2147
final String tempRHSName = environment .allocateLocalTemp ("rhs" );
2148
- final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , source , sourceSection ).makeWriteNode (rhsTranslated );
2148
+ final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , sourceSection ).makeWriteNode (rhsTranslated );
2149
2149
sequence .add (writeTempRHS );
2150
2150
2151
2151
final SplatCastNode rhsSplatCast = SplatCastNodeGen .create (
2152
2152
nilBehavior ,
2153
- true , environment .findLocalVarNode (tempRHSName , source , sourceSection ));
2153
+ true , environment .findLocalVarNode (tempRHSName , sourceSection ));
2154
2154
2155
2155
rhsSplatCast .unsafeSetSourceSection (sourceSection );
2156
2156
2157
2157
final String tempRHSSplattedName = environment .allocateLocalTemp ("rhs" );
2158
- final RubyNode writeTempSplattedRHS = environment .findLocalVarNode (tempRHSSplattedName , source , sourceSection ).makeWriteNode (rhsSplatCast );
2158
+ final RubyNode writeTempSplattedRHS = environment .findLocalVarNode (tempRHSSplattedName , sourceSection ).makeWriteNode (rhsSplatCast );
2159
2159
sequence .add (writeTempSplattedRHS );
2160
2160
2161
- sequence .add (translateDummyAssignment (node .getRest (), environment .findLocalVarNode (tempRHSSplattedName , source , sourceSection )));
2161
+ sequence .add (translateDummyAssignment (node .getRest (), environment .findLocalVarNode (tempRHSSplattedName , sourceSection )));
2162
2162
2163
2163
final RubyNode assignmentResult ;
2164
2164
2165
2165
if (nilBehavior == SplatCastNode .NilBehavior .CONVERT ) {
2166
- assignmentResult = environment .findLocalVarNode (tempRHSSplattedName , source , sourceSection );
2166
+ assignmentResult = environment .findLocalVarNode (tempRHSSplattedName , sourceSection );
2167
2167
} else {
2168
- assignmentResult = environment .findLocalVarNode (tempRHSName , source , sourceSection );
2168
+ assignmentResult = environment .findLocalVarNode (tempRHSName , sourceSection );
2169
2169
}
2170
2170
2171
2171
result = new ElidableResultNode (sequence (sourceSection , sequence ), assignmentResult );
@@ -2194,7 +2194,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2194
2194
final List <RubyNode > sequence = new ArrayList <>();
2195
2195
2196
2196
final String tempRHSName = environment .allocateLocalTemp ("rhs" );
2197
- final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , source , sourceSection ).makeWriteNode (rhsTranslated );
2197
+ final RubyNode writeTempRHS = environment .findLocalVarNode (tempRHSName , sourceSection ).makeWriteNode (rhsTranslated );
2198
2198
sequence .add (writeTempRHS );
2199
2199
2200
2200
/*
@@ -2209,10 +2209,10 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2209
2209
*/
2210
2210
2211
2211
2212
- final RubyNode splatCastNode = SplatCastNodeGen .create (translatingNextExpression ? SplatCastNode .NilBehavior .EMPTY_ARRAY : SplatCastNode .NilBehavior .ARRAY_WITH_NIL , false , environment .findLocalVarNode (tempRHSName , source , sourceSection ));
2212
+ final RubyNode splatCastNode = SplatCastNodeGen .create (translatingNextExpression ? SplatCastNode .NilBehavior .EMPTY_ARRAY : SplatCastNode .NilBehavior .ARRAY_WITH_NIL , false , environment .findLocalVarNode (tempRHSName , sourceSection ));
2213
2213
splatCastNode .unsafeSetSourceSection (sourceSection );
2214
2214
2215
- final RubyNode writeTemp = environment .findLocalVarNode (tempName , source , sourceSection ).makeWriteNode (splatCastNode );
2215
+ final RubyNode writeTemp = environment .findLocalVarNode (tempName , sourceSection ).makeWriteNode (splatCastNode );
2216
2216
2217
2217
sequence .add (writeTemp );
2218
2218
@@ -2221,15 +2221,15 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2221
2221
*/
2222
2222
2223
2223
if (node .getRest () != null ) {
2224
- final ArrayDropTailNode assignedValue = ArrayDropTailNodeGen .create (postArray .size (), environment .findLocalVarNode (tempName , source , sourceSection ));
2224
+ final ArrayDropTailNode assignedValue = ArrayDropTailNodeGen .create (postArray .size (), environment .findLocalVarNode (tempName , sourceSection ));
2225
2225
2226
2226
sequence .add (translateDummyAssignment (node .getRest (), assignedValue ));
2227
2227
}
2228
2228
2229
2229
final List <RubyNode > smallerSequence = new ArrayList <>();
2230
2230
2231
2231
for (int n = 0 ; n < postArray .size (); n ++) {
2232
- final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , source , sourceSection ), node .getPreCount () + n );
2232
+ final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , sourceSection ), node .getPreCount () + n );
2233
2233
smallerSequence .add (translateDummyAssignment (postArray .get (n ), assignedValue ));
2234
2234
}
2235
2235
@@ -2238,7 +2238,7 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2238
2238
final List <RubyNode > atLeastAsLargeSequence = new ArrayList <>();
2239
2239
2240
2240
for (int n = 0 ; n < postArray .size (); n ++) {
2241
- final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , source , sourceSection ), -(postArray .size () - n ));
2241
+ final RubyNode assignedValue = PrimitiveArrayNodeFactory .read (environment .findLocalVarNode (tempName , sourceSection ), -(postArray .size () - n ));
2242
2242
2243
2243
atLeastAsLargeSequence .add (translateDummyAssignment (postArray .get (n ), assignedValue ));
2244
2244
}
@@ -2247,13 +2247,13 @@ public RubyNode visitMultipleAsgnNode(MultipleAsgnParseNode node) {
2247
2247
2248
2248
final RubyNode assignPost =
2249
2249
new IfElseNode (
2250
- new ArrayIsAtLeastAsLargeAsNode (node .getPreCount () + node .getPostCount (), environment .findLocalVarNode (tempName , source , sourceSection )),
2250
+ new ArrayIsAtLeastAsLargeAsNode (node .getPreCount () + node .getPostCount (), environment .findLocalVarNode (tempName , sourceSection )),
2251
2251
atLeastAsLarge ,
2252
2252
smaller );
2253
2253
2254
2254
sequence .add (assignPost );
2255
2255
2256
- result = new ElidableResultNode (sequence (sourceSection , sequence ), environment .findLocalVarNode (tempRHSName , source , sourceSection ));
2256
+ result = new ElidableResultNode (sequence (sourceSection , sequence ), environment .findLocalVarNode (tempRHSName , sourceSection ));
2257
2257
} else {
2258
2258
throw new UnsupportedOperationException ();
2259
2259
}
@@ -2427,7 +2427,7 @@ public RubyNode visitOpAsgnNode(OpAsgnParseNode node) {
2427
2427
final SourceIndexLength sourceSection = pos ;
2428
2428
2429
2429
if (node .isLazy ()) {
2430
- ReadLocalNode readLocal = environment .findLocalVarNode (temp , source , sourceSection );
2430
+ ReadLocalNode readLocal = environment .findLocalVarNode (temp , sourceSection );
2431
2431
body = new IfNode (
2432
2432
new NotNode (new IsNilNode (readLocal )),
2433
2433
body );
0 commit comments