File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -3824,7 +3824,9 @@ impl<'a> Parser<'a> {
3824
3824
fn recover_stmt_ ( & mut self , break_on_semi : SemiColonMode ) {
3825
3825
let mut brace_depth = 0 ;
3826
3826
let mut bracket_depth = 0 ;
3827
+ debug ! ( "recover_stmt_ enter loop" ) ;
3827
3828
loop {
3829
+ debug ! ( "recover_stmt_ loop {:?}" , self . token) ;
3828
3830
match self . token {
3829
3831
token:: OpenDelim ( token:: DelimToken :: Brace ) => {
3830
3832
brace_depth += 1 ;
@@ -3836,6 +3838,7 @@ impl<'a> Parser<'a> {
3836
3838
}
3837
3839
token:: CloseDelim ( token:: DelimToken :: Brace ) => {
3838
3840
if brace_depth == 0 {
3841
+ debug ! ( "recover_stmt_ return - close delim {:?}" , self . token) ;
3839
3842
return ;
3840
3843
}
3841
3844
brace_depth -= 1 ;
@@ -3848,12 +3851,16 @@ impl<'a> Parser<'a> {
3848
3851
}
3849
3852
self . bump ( ) ;
3850
3853
}
3851
- token:: Eof => return ,
3854
+ token:: Eof => {
3855
+ debug ! ( "recover_stmt_ return - Eof" ) ;
3856
+ return ;
3857
+ }
3852
3858
token:: Semi => {
3853
3859
self . bump ( ) ;
3854
3860
if break_on_semi == SemiColonMode :: Break &&
3855
3861
brace_depth == 0 &&
3856
3862
bracket_depth == 0 {
3863
+ debug ! ( "recover_stmt_ return - Semi" ) ;
3857
3864
return ;
3858
3865
}
3859
3866
}
@@ -4042,6 +4049,8 @@ impl<'a> Parser<'a> {
4042
4049
while !self . eat ( & token:: CloseDelim ( token:: Brace ) ) {
4043
4050
let Spanned { node, span} = if let Some ( s) = self . parse_stmt_ ( ) {
4044
4051
s
4052
+ } else if self . token == token:: Eof {
4053
+ break ;
4045
4054
} else {
4046
4055
// Found only `;` or `}`.
4047
4056
continue ;
You can’t perform that action at this time.
0 commit comments