@@ -1350,7 +1350,7 @@ private static class State {
1350
1350
@ Child private DispatchNode dispatch = DispatchNode .create (PUBLIC );
1351
1351
@ Child private CallBlockNode yieldNode = CallBlockNode .create ();
1352
1352
1353
- // Uses block
1353
+ // Uses block and no Symbol
1354
1354
1355
1355
@ Specialization (guards = { "isEmptyArray(array)" , "wasProvided(initialOrSymbol)" })
1356
1356
protected Object injectEmptyArray (RubyArray array , Object initialOrSymbol , NotProvided symbol , RubyProc block ) {
@@ -1380,7 +1380,7 @@ protected Object injectNoInitial(
1380
1380
return injectBlockHelper (array , block , stores .read (store , 0 ), 1 , iteratorNode );
1381
1381
}
1382
1382
1383
- public Object injectBlockHelper (RubyArray array ,
1383
+ private Object injectBlockHelper (RubyArray array ,
1384
1384
RubyProc block , Object initial , int start , ArrayEachIteratorNode iteratorNode ) {
1385
1385
Object accumulator = initial ;
1386
1386
State iterationState = new State (accumulator , block );
@@ -1397,7 +1397,7 @@ public void accept(RubyArray array, Object stateObject, Object element, int inde
1397
1397
state .accumulator = accumulator ;
1398
1398
}
1399
1399
1400
- // Uses Symbol
1400
+ // Uses Symbol and no block
1401
1401
1402
1402
@ Specialization (guards = { "isEmptyArray(array)" })
1403
1403
protected Object injectSymbolEmptyArrayNoInitial (
@@ -1409,8 +1409,7 @@ protected Object injectSymbolEmptyArrayNoInitial(
1409
1409
guards = {
1410
1410
"isEmptyArray(array)" ,
1411
1411
"wasProvided(initialOrSymbol)" })
1412
- protected Object injectSymbolEmptyArray (
1413
- RubyArray array , Object initialOrSymbol , RubySymbol symbol , Object maybeBlock ) {
1412
+ protected Object injectSymbolEmptyArray (RubyArray array , Object initialOrSymbol , RubySymbol symbol , Nil block ) {
1414
1413
return initialOrSymbol ;
1415
1414
}
1416
1415
@@ -1442,17 +1441,12 @@ protected Object injectSymbolNoInitial(
1442
1441
"wasProvided(initialOrSymbol)" },
1443
1442
limit = "storageStrategyLimit()" )
1444
1443
protected Object injectSymbolWithInitial (
1445
- VirtualFrame frame , RubyArray array , Object initialOrSymbol , RubySymbol symbol , Object block ,
1444
+ VirtualFrame frame , RubyArray array , Object initialOrSymbol , RubySymbol symbol , Nil block ,
1446
1445
@ Bind ("array.getStore()" ) Object store ,
1447
1446
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
1448
1447
@ Cached IntValueProfile arraySizeProfile ,
1449
1448
@ Cached LoopConditionProfile loopProfile ,
1450
- @ Cached ToJavaStringNode toJavaString ,
1451
- @ Cached ("new()" ) WarningNode warningNode ) {
1452
- if (warningNode .shouldWarn ()) {
1453
- final SourceSection sourceSection = getContext ().getCallStack ().getTopMostUserSourceSection ();
1454
- warningNode .warningMessage (sourceSection , "given block not used" );
1455
- }
1449
+ @ Cached ToJavaStringNode toJavaString ) {
1456
1450
return injectSymbolHelper (
1457
1451
frame ,
1458
1452
array ,
@@ -1465,15 +1459,7 @@ protected Object injectSymbolWithInitial(
1465
1459
loopProfile );
1466
1460
}
1467
1461
1468
- // No Symbol or Block
1469
-
1470
- @ Specialization
1471
- protected Object injectNoSymbolNonEmptyArrayNoInitial (
1472
- RubyArray array , NotProvided initialOrSymbol , NotProvided symbol , Nil block ) {
1473
- throw new RaiseException (getContext (), coreExceptions ().argumentError ("no block or symbol given" , this ));
1474
- }
1475
-
1476
- public Object injectSymbolHelper (VirtualFrame frame , RubyArray array , String symbol ,
1462
+ private Object injectSymbolHelper (VirtualFrame frame , RubyArray array , String symbol ,
1477
1463
ArrayStoreLibrary stores , Object store , Object initial , int start ,
1478
1464
IntValueProfile arraySizeProfile , LoopConditionProfile loopProfile ) {
1479
1465
Object accumulator = initial ;
0 commit comments