@@ -563,27 +563,9 @@ impl State {
563
563
self . idx += 1 ;
564
564
self . current_span = globals. get_stmt ( ( self . package , * stmt) . into ( ) ) . span ;
565
565
566
- if let Some ( bp) = breakpoints
567
- . iter ( )
568
- . find ( |& bp| * bp == * stmt && self . package == self . source_package )
569
- {
570
- StepResult :: BreakpointHit ( * bp)
571
- } else {
572
- if self . current_span == Span :: default ( ) {
573
- // if there is no span, we are in generated code, so we should skip
574
- continue ;
575
- }
576
- // no breakpoint, but we may stop here
577
- if step == StepAction :: In {
578
- StepResult :: StepIn
579
- } else if step == StepAction :: Next && current_frame >= self . call_stack . len ( )
580
- {
581
- StepResult :: Next
582
- } else if step == StepAction :: Out && current_frame > self . call_stack . len ( ) {
583
- StepResult :: StepOut
584
- } else {
585
- continue ;
586
- }
566
+ match self . check_for_break ( breakpoints, * stmt, step, current_frame) {
567
+ Some ( value) => value,
568
+ None => continue ,
587
569
}
588
570
}
589
571
Some ( ExecGraphNode :: Jump ( idx) ) => {
@@ -623,6 +605,16 @@ impl State {
623
605
env. leave_scope ( ) ;
624
606
continue ;
625
607
}
608
+ Some ( ExecGraphNode :: PushScope ) => {
609
+ self . push_scope ( env) ;
610
+ self . idx += 1 ;
611
+ continue ;
612
+ }
613
+ Some ( ExecGraphNode :: PopScope ) => {
614
+ env. leave_scope ( ) ;
615
+ self . idx += 1 ;
616
+ continue ;
617
+ }
626
618
None => {
627
619
// We have reached the end of the current graph without reaching an explicit return node,
628
620
// usually indicating the partial execution of a single sub-expression.
@@ -644,6 +636,38 @@ impl State {
644
636
Ok ( StepResult :: Return ( self . get_result ( ) ) )
645
637
}
646
638
639
+ fn check_for_break (
640
+ & self ,
641
+ breakpoints : & [ StmtId ] ,
642
+ stmt : StmtId ,
643
+ step : StepAction ,
644
+ current_frame : usize ,
645
+ ) -> Option < StepResult > {
646
+ Some (
647
+ if let Some ( bp) = breakpoints
648
+ . iter ( )
649
+ . find ( |& bp| * bp == stmt && self . package == self . source_package )
650
+ {
651
+ StepResult :: BreakpointHit ( * bp)
652
+ } else {
653
+ if self . current_span == Span :: default ( ) {
654
+ // if there is no span, we are in generated code, so we should skip
655
+ return None ;
656
+ }
657
+ // no breakpoint, but we may stop here
658
+ if step == StepAction :: In {
659
+ StepResult :: StepIn
660
+ } else if step == StepAction :: Next && current_frame >= self . call_stack . len ( ) {
661
+ StepResult :: Next
662
+ } else if step == StepAction :: Out && current_frame > self . call_stack . len ( ) {
663
+ StepResult :: StepOut
664
+ } else {
665
+ return None ;
666
+ }
667
+ } ,
668
+ )
669
+ }
670
+
647
671
pub fn get_result ( & mut self ) -> Value {
648
672
// Some executions don't have any statements to execute,
649
673
// such as a fragment that has only item definitions.
0 commit comments