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 @@ -3809,7 +3809,9 @@ impl<'a> Parser<'a> {
3809
3809
fn recover_stmt_ ( & mut self , break_on_semi : SemiColonMode ) {
3810
3810
let mut brace_depth = 0 ;
3811
3811
let mut bracket_depth = 0 ;
3812
+ debug ! ( "recover_stmt_ enter loop" ) ;
3812
3813
loop {
3814
+ debug ! ( "recover_stmt_ loop {:?}" , self . token) ;
3813
3815
match self . token {
3814
3816
token:: OpenDelim ( token:: DelimToken :: Brace ) => {
3815
3817
brace_depth += 1 ;
@@ -3821,6 +3823,7 @@ impl<'a> Parser<'a> {
3821
3823
}
3822
3824
token:: CloseDelim ( token:: DelimToken :: Brace ) => {
3823
3825
if brace_depth == 0 {
3826
+ debug ! ( "recover_stmt_ return - close delim {:?}" , self . token) ;
3824
3827
return ;
3825
3828
}
3826
3829
brace_depth -= 1 ;
@@ -3833,12 +3836,16 @@ impl<'a> Parser<'a> {
3833
3836
}
3834
3837
self . bump ( ) ;
3835
3838
}
3836
- token:: Eof => return ,
3839
+ token:: Eof => {
3840
+ debug ! ( "recover_stmt_ return - Eof" ) ;
3841
+ return ;
3842
+ }
3837
3843
token:: Semi => {
3838
3844
self . bump ( ) ;
3839
3845
if break_on_semi == SemiColonMode :: Break &&
3840
3846
brace_depth == 0 &&
3841
3847
bracket_depth == 0 {
3848
+ debug ! ( "recover_stmt_ return - Semi" ) ;
3842
3849
return ;
3843
3850
}
3844
3851
}
@@ -4027,6 +4034,8 @@ impl<'a> Parser<'a> {
4027
4034
while !self . eat ( & token:: CloseDelim ( token:: Brace ) ) {
4028
4035
let Spanned { node, span} = if let Some ( s) = self . parse_stmt_ ( ) {
4029
4036
s
4037
+ } else if self . token == token:: Eof {
4038
+ break ;
4030
4039
} else {
4031
4040
// Found only `;` or `}`.
4032
4041
continue ;
You can’t perform that action at this time.
0 commit comments