@@ -315,9 +315,6 @@ pub fn eat_any_ts_modifier<'a>(p: &mut impl Parser<'a>) -> PResult<bool> {
315315 if p. syntax ( ) . typescript ( )
316316 && {
317317 let cur = p. input ( ) . cur ( ) ;
318- if cur. is_eof ( ) {
319- return Err ( eof_error ( p) ) ;
320- }
321318 cur. is_public ( ) || cur. is_protected ( ) || cur. is_private ( ) || cur. is_readonly ( )
322319 }
323320 && peek ! ( p) . is_some_and ( |t| t. is_word ( ) || t. is_lbrace ( ) || t. is_lbracket ( ) )
@@ -337,9 +334,7 @@ pub fn parse_ts_modifier<'a, P: Parser<'a>>(
337334 allowed_modifiers : & [ & ' static str ] ,
338335 stop_on_start_of_class_static_blocks : bool ,
339336) -> PResult < Option < & ' static str > > {
340- if !p. input ( ) . syntax ( ) . typescript ( ) {
341- return Ok ( None ) ;
342- }
337+ debug_assert ! ( p. input( ) . syntax( ) . typescript( ) ) ;
343338 let pos = {
344339 let cur = p. input ( ) . cur ( ) ;
345340 let modifier = if cur. is_unknown_ident ( ) {
@@ -431,7 +426,7 @@ pub fn parse_ts_entity_name<'a, P: Parser<'a>>(
431426 while p. input_mut ( ) . eat ( & P :: Token :: DOT ) {
432427 let dot_start = p. input ( ) . cur_pos ( ) ;
433428 let cur = p. input ( ) . cur ( ) ;
434- if cur . is_eof ( ) || ( !cur. is_hash ( ) && !cur. is_word ( ) ) {
429+ if !cur. is_hash ( ) && !cur. is_word ( ) {
435430 p. emit_err (
436431 Span :: new_with_checked ( dot_start, dot_start) ,
437432 SyntaxError :: TS1003 ,
@@ -2128,7 +2123,7 @@ pub fn parse_ts_interface_decl<'a, P: Parser<'a>>(
21282123 if p. input ( ) . is ( & P :: Token :: EXTENDS ) {
21292124 p. emit_err ( p. input ( ) . cur_span ( ) , SyntaxError :: TS1172 ) ;
21302125
2131- while !eof ! ( p ) && !p. input ( ) . is ( & P :: Token :: LBRACE ) {
2126+ while !p . input ( ) . cur ( ) . is_eof ( ) && !p. input ( ) . is ( & P :: Token :: LBRACE ) {
21322127 p. bump ( ) ;
21332128 }
21342129 }
0 commit comments