30
30
import org .truffleruby .annotations .CoreModule ;
31
31
import org .truffleruby .annotations .Primitive ;
32
32
import org .truffleruby .builtins .PrimitiveArrayArgumentsNode ;
33
- import org .truffleruby .builtins .YieldingCoreMethodNode ;
34
33
import org .truffleruby .collections .SimpleStack ;
35
34
import org .truffleruby .core .CoreLibrary ;
36
35
import org .truffleruby .core .Hashing ;
@@ -661,7 +660,7 @@ protected RubyArray concatManyGeneral(RubyArray array, Object first, Object[] re
661
660
662
661
@ CoreMethod (names = "delete" , required = 1 , needsBlock = true )
663
662
@ ImportStatic (ArrayGuards .class )
664
- public abstract static class DeleteNode extends YieldingCoreMethodNode {
663
+ public abstract static class DeleteNode extends CoreMethodArrayArgumentsNode {
665
664
666
665
@ Child private SameOrEqualNode sameOrEqualNode = SameOrEqualNode .create ();
667
666
@ Child private TypeNodes .CheckFrozenNode raiseIfFrozenNode ;
@@ -743,7 +742,7 @@ private Object delete(RubyArray array, Object value, Object maybeBlock,
743
742
if (maybeBlock == nil ) {
744
743
return nil ;
745
744
} else {
746
- return callBlock ( yieldNode , (RubyProc ) maybeBlock , value );
745
+ return yieldNode . yield ( (RubyProc ) maybeBlock , value );
747
746
}
748
747
}
749
748
}
@@ -825,7 +824,7 @@ protected Object deleteAtCopying(RubyArray array, int index,
825
824
826
825
@ CoreMethod (names = "each" , needsBlock = true , enumeratorSize = "size" )
827
826
@ ImportStatic (ArrayGuards .class )
828
- public abstract static class EachNode extends YieldingCoreMethodNode implements ArrayElementConsumerNode {
827
+ public abstract static class EachNode extends CoreMethodArrayArgumentsNode implements ArrayElementConsumerNode {
829
828
830
829
@ Specialization
831
830
protected Object each (RubyArray array , RubyProc block ,
@@ -836,7 +835,7 @@ protected Object each(RubyArray array, RubyProc block,
836
835
@ Override
837
836
public void accept (CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ) {
838
837
RubyProc block = (RubyProc ) state ;
839
- callBlock ( yieldNode , block , element );
838
+ yieldNode . yield ( block , element );
840
839
}
841
840
842
841
}
@@ -1125,7 +1124,7 @@ protected boolean include(RubyArray array, Object value,
1125
1124
lowerFixnum = 1 ,
1126
1125
argumentNames = { "size_or_copy" , "filling_value" , "block" })
1127
1126
@ ImportStatic ({ ArrayGuards .class , ArrayStoreLibrary .class })
1128
- public abstract static class InitializeNode extends YieldingCoreMethodNode {
1127
+ public abstract static class InitializeNode extends CoreMethodArrayArgumentsNode {
1129
1128
1130
1129
@ Child private ToIntNode toIntNode ;
1131
1130
@ Child private DispatchNode toAryNode ;
@@ -1244,7 +1243,7 @@ protected Object initializeBlock(RubyArray array, int size, Object unusedFilling
1244
1243
int n = 0 ;
1245
1244
try {
1246
1245
for (; loopProfile .inject (n < size ); n ++) {
1247
- final Object value = callBlock ( yieldNode , block , n );
1246
+ final Object value = yieldNode . yield ( block , n );
1248
1247
arrayBuilder .appendValue (state , n , value );
1249
1248
}
1250
1249
} finally {
@@ -1479,7 +1478,7 @@ private Object injectSymbolHelper(VirtualFrame frame, RubyArray array, String sy
1479
1478
1480
1479
@ CoreMethod (names = { "map" , "collect" }, needsBlock = true , enumeratorSize = "size" )
1481
1480
@ ImportStatic (ArrayGuards .class )
1482
- public abstract static class MapNode extends YieldingCoreMethodNode implements ArrayElementConsumerNode {
1481
+ public abstract static class MapNode extends CoreMethodArrayArgumentsNode implements ArrayElementConsumerNode {
1483
1482
1484
1483
private static class State {
1485
1484
final BuilderState builderState ;
@@ -1510,15 +1509,16 @@ protected Object map(RubyArray array, RubyProc block,
1510
1509
public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
1511
1510
final State state = (State ) stateObject ;
1512
1511
1513
- Object value = callBlock ( yieldNode , state .block , element );
1512
+ Object value = yieldNode . yield ( state .block , element );
1514
1513
arrayBuilder .appendValue (state .builderState , index , value );
1515
1514
}
1516
1515
1517
1516
}
1518
1517
1519
1518
@ CoreMethod (names = { "map!" , "collect!" }, needsBlock = true , enumeratorSize = "size" , raiseIfFrozenSelf = true )
1520
1519
@ ImportStatic (ArrayGuards .class )
1521
- public abstract static class MapInPlaceNode extends YieldingCoreMethodNode implements ArrayElementConsumerNode {
1520
+ public abstract static class MapInPlaceNode extends CoreMethodArrayArgumentsNode
1521
+ implements ArrayElementConsumerNode {
1522
1522
1523
1523
@ Child private ArrayWriteNormalizedNode writeNode = ArrayWriteNormalizedNodeGen .create ();
1524
1524
@@ -1531,7 +1531,7 @@ protected Object map(RubyArray array, RubyProc block,
1531
1531
@ Override
1532
1532
public void accept (CallBlockNode yieldNode , RubyArray array , Object state , Object element , int index ) {
1533
1533
RubyProc block = (RubyProc ) state ;
1534
- writeNode .executeWrite (array , index , callBlock ( yieldNode , block , element ));
1534
+ writeNode .executeWrite (array , index , yieldNode . yield ( block , element ));
1535
1535
}
1536
1536
1537
1537
}
@@ -1763,7 +1763,7 @@ protected RubyArray pushMany(VirtualFrame frame, RubyArray array, Object value,
1763
1763
1764
1764
@ CoreMethod (names = "reject" , needsBlock = true , enumeratorSize = "size" )
1765
1765
@ ImportStatic (ArrayGuards .class )
1766
- public abstract static class RejectNode extends YieldingCoreMethodNode implements ArrayElementConsumerNode {
1766
+ public abstract static class RejectNode extends CoreMethodArrayArgumentsNode implements ArrayElementConsumerNode {
1767
1767
1768
1768
private static class State {
1769
1769
final BuilderState builderState ;
@@ -1797,7 +1797,7 @@ protected Object reject(RubyArray array, RubyProc block,
1797
1797
public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
1798
1798
final State state = (State ) stateObject ;
1799
1799
1800
- if (!booleanCastNode .execute (callBlock ( yieldNode , state .block , element ))) {
1800
+ if (!booleanCastNode .execute (yieldNode . yield ( state .block , element ))) {
1801
1801
arrayBuilder .appendValue (state .builderState , state .newArraySize , element );
1802
1802
state .newArraySize ++;
1803
1803
}
@@ -1976,7 +1976,7 @@ private void reverse(ArrayStoreLibrary stores,
1976
1976
1977
1977
@ CoreMethod (names = { "select" , "filter" }, needsBlock = true , enumeratorSize = "size" )
1978
1978
@ ImportStatic (ArrayGuards .class )
1979
- public abstract static class SelectNode extends YieldingCoreMethodNode implements ArrayElementConsumerNode {
1979
+ public abstract static class SelectNode extends CoreMethodArrayArgumentsNode implements ArrayElementConsumerNode {
1980
1980
1981
1981
private static class State {
1982
1982
final BuilderState builderState ;
@@ -2010,7 +2010,7 @@ protected Object select(RubyArray array, RubyProc block,
2010
2010
public void accept (CallBlockNode yieldNode , RubyArray array , Object stateObject , Object element , int index ) {
2011
2011
final State state = (State ) stateObject ;
2012
2012
2013
- if (booleanCastNode .execute (callBlock ( yieldNode , state .block , element ))) {
2013
+ if (booleanCastNode .execute (yieldNode . yield ( state .block , element ))) {
2014
2014
arrayBuilder .appendValue (state .builderState , state .selectedSize , element );
2015
2015
state .selectedSize ++;
2016
2016
}
0 commit comments