@@ -2625,31 +2625,8 @@ public RubyNode visitUndefNode(org.jruby.ast.UndefNode node) {
2625
2625
2626
2626
@ Override
2627
2627
public RubyNode visitUntilNode (org .jruby .ast .UntilNode node ) {
2628
- final SourceSection sourceSection = translate (node .getPosition ());
2629
-
2630
- RubyNode condition = node .getConditionNode ().accept (this );
2631
- RubyNode conditionInversed = new NotNode (context , sourceSection , condition );
2632
-
2633
- final boolean oldTranslatingWhile = translatingWhile ;
2634
- translatingWhile = true ;
2635
-
2636
- final RubyNode body ;
2637
-
2638
- try {
2639
- body = node .getBodyNode ().accept (this );
2640
- } finally {
2641
- translatingWhile = oldTranslatingWhile ;
2642
- }
2643
-
2644
- final RubyNode loop ;
2645
-
2646
- if (node .evaluateAtStart ()) {
2647
- loop = WhileNode .createWhile (context , sourceSection , conditionInversed , body );
2648
- } else {
2649
- loop = WhileNode .createDoWhile (context , sourceSection , conditionInversed , body );
2650
- }
2651
-
2652
- return new CatchBreakFromCallNode (context , sourceSection , loop , environment .getBlockID ());
2628
+ org .jruby .ast .WhileNode whileNode = new org .jruby .ast .WhileNode (node .getPosition (), node .getConditionNode (), node .getBodyNode (), node .evaluateAtStart ());
2629
+ return visitWhileNode (whileNode , true );
2653
2630
}
2654
2631
2655
2632
@ Override
@@ -2666,23 +2643,27 @@ public RubyNode visitVCallNode(org.jruby.ast.VCallNode node) {
2666
2643
2667
2644
@ Override
2668
2645
public RubyNode visitWhileNode (org .jruby .ast .WhileNode node ) {
2646
+ return visitWhileNode (node , false );
2647
+ }
2648
+
2649
+ private RubyNode visitWhileNode (org .jruby .ast .WhileNode node , boolean conditionInversed ) {
2669
2650
final SourceSection sourceSection = translate (node .getPosition ());
2670
2651
2671
2652
RubyNode condition = node .getConditionNode ().accept (this );
2653
+ if (conditionInversed ) {
2654
+ condition = new NotNode (context , sourceSection , condition );
2655
+ }
2672
2656
2657
+ final RubyNode body ;
2673
2658
final boolean oldTranslatingWhile = translatingWhile ;
2674
2659
translatingWhile = true ;
2675
-
2676
- final RubyNode body ;
2677
-
2678
2660
try {
2679
2661
body = node .getBodyNode ().accept (this );
2680
2662
} finally {
2681
2663
translatingWhile = oldTranslatingWhile ;
2682
2664
}
2683
2665
2684
2666
final RubyNode loop ;
2685
-
2686
2667
if (node .evaluateAtStart ()) {
2687
2668
loop = WhileNode .createWhile (context , sourceSection , condition , body );
2688
2669
} else {
0 commit comments