@@ -235,7 +235,7 @@ public RubyNode visitAliasMethodNode(Nodes.AliasMethodNode node) {
235
235
236
236
@ Override
237
237
public RubyNode visitAlternationPatternNode (Nodes .AlternationPatternNode node ) {
238
- return defaultVisit ( node );
238
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
239
239
}
240
240
241
241
@ Override
@@ -276,7 +276,17 @@ public RubyNode visitArrayNode(Nodes.ArrayNode node) {
276
276
277
277
@ Override
278
278
public RubyNode visitArrayPatternNode (Nodes .ArrayPatternNode node ) {
279
- return defaultVisit (node );
279
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPPatternMatchingTranslator" );
280
+ }
281
+
282
+ @ Override
283
+ public RubyNode visitAssocNode (Nodes .AssocNode node ) {
284
+ throw CompilerDirectives .shouldNotReachHere ("handled in visitHashNode/getKeywordArgumentsDescriptor" );
285
+ }
286
+
287
+ @ Override
288
+ public RubyNode visitAssocSplatNode (Nodes .AssocSplatNode node ) {
289
+ throw CompilerDirectives .shouldNotReachHere ("handled in visitHashNode/getKeywordArgumentsDescriptor" );
280
290
}
281
291
282
292
@ Override
@@ -440,7 +450,7 @@ private RescueNode translateExceptionNodes(ArrayList<Nodes.Node> exceptionNodes,
440
450
441
451
@ Override
442
452
public RubyNode visitBlockLocalVariableNode (Nodes .BlockLocalVariableNode node ) {
443
- return super . visitBlockLocalVariableNode ( node );
453
+ throw CompilerDirectives . shouldNotReachHere ( "handled in translateBlockAndLambda" );
444
454
}
445
455
446
456
@ Override
@@ -467,6 +477,7 @@ private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.Node parametersN
467
477
468
478
final Nodes .ParametersNode parameters ;
469
479
if (parametersNode instanceof Nodes .BlockParametersNode blockParameters ) {
480
+ // NOTE: we ignore BlockParametersNode#locals, it is fully redundant with BlockNode#locals/LambdaNode#locals
470
481
parameters = blockParameters .parameters != null ? blockParameters .parameters : ZERO_PARAMETERS_NODE ;
471
482
} else if (parametersNode instanceof Nodes .NumberedParametersNode numberedParameters ) {
472
483
// build Nodes.BlockParametersNode with required parameters _1, _2, etc
@@ -553,6 +564,16 @@ public RubyNode visitBlockArgumentNode(Nodes.BlockArgumentNode node) {
553
564
return assignPositionAndFlags (node , rubyNode );
554
565
}
555
566
567
+ @ Override
568
+ public RubyNode visitBlockParameterNode (Nodes .BlockParameterNode node ) {
569
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
570
+ }
571
+
572
+ @ Override
573
+ public RubyNode visitBlockParametersNode (Nodes .BlockParametersNode node ) {
574
+ throw CompilerDirectives .shouldNotReachHere ("handled in translateBlockAndLambda" );
575
+ }
576
+
556
577
@ Override
557
578
public RubyNode visitBreakNode (Nodes .BreakNode node ) {
558
579
// detect syntax error
@@ -898,7 +919,7 @@ public RubyNode visitCallTargetNode(Nodes.CallTargetNode node) {
898
919
899
920
@ Override
900
921
public RubyNode visitCapturePatternNode (Nodes .CapturePatternNode node ) {
901
- return defaultVisit ( node );
922
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
902
923
}
903
924
904
925
@ Override
@@ -1574,7 +1595,7 @@ public RubyNode visitFalseNode(Nodes.FalseNode node) {
1574
1595
1575
1596
@ Override
1576
1597
public RubyNode visitFindPatternNode (Nodes .FindPatternNode node ) {
1577
- return defaultVisit ( node );
1598
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
1578
1599
}
1579
1600
1580
1601
@ Override
@@ -1752,6 +1773,11 @@ public RubyNode visitForwardingArgumentsNode(Nodes.ForwardingArgumentsNode node)
1752
1773
throw CompilerDirectives .shouldNotReachHere ("handled in visitCallNode" );
1753
1774
}
1754
1775
1776
+ @ Override
1777
+ public RubyNode visitForwardingParameterNode (Nodes .ForwardingParameterNode node ) {
1778
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
1779
+ }
1780
+
1755
1781
@ Override
1756
1782
public RubyNode visitForwardingSuperNode (Nodes .ForwardingSuperNode node ) {
1757
1783
var argumentsAndBlock = translateArgumentsAndBlock (null , node .block , environment .getMethodName ());
@@ -1945,7 +1971,7 @@ public RubyNode visitHashNode(Nodes.HashNode node) {
1945
1971
1946
1972
@ Override
1947
1973
public RubyNode visitHashPatternNode (Nodes .HashPatternNode node ) {
1948
- return defaultVisit ( node );
1974
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
1949
1975
}
1950
1976
1951
1977
@ Override
@@ -1992,12 +2018,12 @@ public RubyNode visitImplicitNode(Nodes.ImplicitNode node) {
1992
2018
1993
2019
@ Override
1994
2020
public RubyNode visitImplicitRestNode (Nodes .ImplicitRestNode node ) {
1995
- return super . visitImplicitRestNode ( node );
2021
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPLoadArgumentsTranslator" );
1996
2022
}
1997
2023
1998
2024
@ Override
1999
2025
public RubyNode visitInNode (Nodes .InNode node ) {
2000
- return defaultVisit ( node );
2026
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
2001
2027
}
2002
2028
2003
2029
@ Override
@@ -2426,6 +2452,11 @@ public RubyNode visitKeywordHashNode(Nodes.KeywordHashNode node) {
2426
2452
return hash .accept (this );
2427
2453
}
2428
2454
2455
+ @ Override
2456
+ public RubyNode visitKeywordRestParameterNode (Nodes .KeywordRestParameterNode node ) {
2457
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2458
+ }
2459
+
2429
2460
@ Override
2430
2461
public RubyNode visitLambdaNode (Nodes .LambdaNode node ) {
2431
2462
return translateBlockAndLambda (node , node .parameters , node .body , node .locals , null );
@@ -2615,7 +2646,7 @@ private RubyNode match2NonNilSetter(String name, int tempSlot, SourceIndexLength
2615
2646
2616
2647
@ Override
2617
2648
public RubyNode visitMissingNode (Nodes .MissingNode node ) {
2618
- return defaultVisit (node );
2649
+ throw fail (node );
2619
2650
}
2620
2651
2621
2652
@ Override
@@ -2646,6 +2677,11 @@ public RubyNode visitMultiWriteNode(Nodes.MultiWriteNode node) {
2646
2677
return assignPositionAndFlags (node , rubyNode );
2647
2678
}
2648
2679
2680
+ @ Override
2681
+ public RubyNode visitMultiTargetNode (Nodes .MultiTargetNode node ) {
2682
+ throw CompilerDirectives .shouldNotReachHere ("handled in visitForNode and other places" );
2683
+ }
2684
+
2649
2685
@ Override
2650
2686
public RubyNode visitNextNode (Nodes .NextNode node ) {
2651
2687
// detect syntax error
@@ -2681,6 +2717,16 @@ public RubyNode visitNilNode(Nodes.NilNode node) {
2681
2717
return assignPositionAndFlags (node , rubyNode );
2682
2718
}
2683
2719
2720
+ @ Override
2721
+ public RubyNode visitNoKeywordsParameterNode (Nodes .NoKeywordsParameterNode node ) {
2722
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2723
+ }
2724
+
2725
+ @ Override
2726
+ public RubyNode visitNumberedParametersNode (Nodes .NumberedParametersNode node ) {
2727
+ throw CompilerDirectives .shouldNotReachHere ("handled in translateBlockAndLambda" );
2728
+ }
2729
+
2684
2730
@ Override
2685
2731
public RubyNode visitNumberedReferenceReadNode (Nodes .NumberedReferenceReadNode node ) {
2686
2732
final RubyNode lastMatchNode = ReadGlobalVariableNodeGen .create ("$~" );
@@ -2689,6 +2735,16 @@ public RubyNode visitNumberedReferenceReadNode(Nodes.NumberedReferenceReadNode n
2689
2735
return assignPositionAndFlags (node , rubyNode );
2690
2736
}
2691
2737
2738
+ @ Override
2739
+ public RubyNode visitOptionalKeywordParameterNode (Nodes .OptionalKeywordParameterNode node ) {
2740
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2741
+ }
2742
+
2743
+ @ Override
2744
+ public RubyNode visitOptionalParameterNode (Nodes .OptionalParameterNode node ) {
2745
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2746
+ }
2747
+
2692
2748
@ Override
2693
2749
public RubyNode visitOrNode (Nodes .OrNode node ) {
2694
2750
final RubyNode left = node .left .accept (this );
@@ -2698,6 +2754,11 @@ public RubyNode visitOrNode(Nodes.OrNode node) {
2698
2754
return assignPositionAndFlags (node , rubyNode );
2699
2755
}
2700
2756
2757
+ @ Override
2758
+ public RubyNode visitParametersNode (Nodes .ParametersNode node ) {
2759
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2760
+ }
2761
+
2701
2762
@ Override
2702
2763
public RubyNode visitParenthesesNode (Nodes .ParenthesesNode node ) {
2703
2764
if (node .body == null ) {
@@ -2709,12 +2770,12 @@ public RubyNode visitParenthesesNode(Nodes.ParenthesesNode node) {
2709
2770
2710
2771
@ Override
2711
2772
public RubyNode visitPinnedExpressionNode (Nodes .PinnedExpressionNode node ) {
2712
- return defaultVisit ( node );
2773
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
2713
2774
}
2714
2775
2715
2776
@ Override
2716
2777
public RubyNode visitPinnedVariableNode (Nodes .PinnedVariableNode node ) {
2717
- return defaultVisit ( node );
2778
+ throw CompilerDirectives . shouldNotReachHere ( "handled in YARPPatternMatchingTranslator" );
2718
2779
}
2719
2780
2720
2781
@ Override
@@ -2921,6 +2982,16 @@ private RaiseException regexpErrorToSyntaxError(DeferredRaiseException dre, Node
2921
2982
}
2922
2983
}
2923
2984
2985
+ @ Override
2986
+ public RubyNode visitRequiredKeywordParameterNode (Nodes .RequiredKeywordParameterNode node ) {
2987
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2988
+ }
2989
+
2990
+ @ Override
2991
+ public RubyNode visitRequiredParameterNode (Nodes .RequiredParameterNode node ) {
2992
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2993
+ }
2994
+
2924
2995
@ Override
2925
2996
public RubyNode visitRescueModifierNode (Nodes .RescueModifierNode node ) {
2926
2997
// use Ruby StandardError class as far as exception class cannot be specified
@@ -2941,7 +3012,12 @@ public RubyNode visitRescueModifierNode(Nodes.RescueModifierNode node) {
2941
3012
2942
3013
@ Override
2943
3014
public RubyNode visitRescueNode (Nodes .RescueNode node ) {
2944
- return defaultVisit (node );
3015
+ throw CompilerDirectives .shouldNotReachHere ("handled in visitBeginNode" );
3016
+ }
3017
+
3018
+ @ Override
3019
+ public RubyNode visitRestParameterNode (Nodes .RestParameterNode node ) {
3020
+ throw CompilerDirectives .shouldNotReachHere ("handled in YARPLoadArgumentsTranslator" );
2945
3021
}
2946
3022
2947
3023
@ Override
@@ -3190,6 +3266,11 @@ public RubyNode visitUntilNode(Nodes.UntilNode node) {
3190
3266
return assignPositionAndFlags (node , rubyNode );
3191
3267
}
3192
3268
3269
+ @ Override
3270
+ public RubyNode visitWhenNode (Nodes .WhenNode node ) {
3271
+ throw CompilerDirectives .shouldNotReachHere ("handled in visitCaseNode" );
3272
+ }
3273
+
3193
3274
@ Override
3194
3275
public RubyNode visitWhileNode (Nodes .WhileNode node ) {
3195
3276
final RubyNode rubyNode = translateWhileNode (node , node .predicate , node .statements , false ,
0 commit comments