6464{
6565 debug_assert ! ( p. input( ) . syntax( ) . typescript( ) ) ;
6666 let mut buf = Vec :: with_capacity ( 8 ) ;
67- while !is_ts_list_terminator ( p, kind) ? {
67+ while !is_ts_list_terminator ( p, kind) {
6868 // Skipping "parseListElement" from the TS source since that's just for error
6969 // handling.
7070 buf. push ( parse_element ( p) ?) ;
@@ -111,7 +111,7 @@ where
111111 loop {
112112 trace_cur ! ( p, parse_ts_delimited_list_inner__element) ;
113113
114- if is_ts_list_terminator ( p, kind) ? {
114+ if is_ts_list_terminator ( p, kind) {
115115 break ;
116116 }
117117
@@ -122,7 +122,7 @@ where
122122 continue ;
123123 }
124124
125- if is_ts_list_terminator ( p, kind) ? {
125+ if is_ts_list_terminator ( p, kind) {
126126 break ;
127127 }
128128
@@ -162,31 +162,31 @@ where
162162}
163163
164164/// `tsIsListTerminator`
165- pub fn is_ts_list_terminator < ' a > ( p : & mut impl Parser < ' a > , kind : ParsingContext ) -> PResult < bool > {
165+ fn is_ts_list_terminator < ' a > ( p : & mut impl Parser < ' a > , kind : ParsingContext ) -> bool {
166166 debug_assert ! ( p. input( ) . syntax( ) . typescript( ) ) ;
167167 let Some ( cur) = p. input_mut ( ) . cur ( ) else {
168- return Ok ( false ) ;
168+ return false ;
169169 } ;
170- Ok ( match kind {
170+ match kind {
171171 ParsingContext :: EnumMembers | ParsingContext :: TypeMembers => cur. is_rbrace ( ) ,
172172 ParsingContext :: HeritageClauseElement => {
173173 cur. is_lbrace ( ) || cur. is_implements ( ) || cur. is_extends ( )
174174 }
175175 ParsingContext :: TupleElementTypes => cur. is_rbracket ( ) ,
176176 ParsingContext :: TypeParametersOrArguments => cur. is_greater ( ) ,
177- } )
177+ }
178178}
179179
180180/// `tsNextTokenCanFollowModifier`
181- pub ( super ) fn ts_next_token_can_follow_modifier < ' a > ( p : & mut impl Parser < ' a > ) -> PResult < bool > {
181+ fn ts_next_token_can_follow_modifier < ' a > ( p : & mut impl Parser < ' a > ) -> bool {
182182 debug_assert ! ( p. input( ) . syntax( ) . typescript( ) ) ;
183183 // Note: TypeScript's implementation is much more complicated because
184184 // more things are considered modifiers there.
185185 // This implementation only handles modifiers not handled by @babel/parser
186186 // itself. And "static". TODO: Would be nice to avoid lookahead. Want a
187187 // hasLineBreakUpNext() method...
188188 p. bump ( ) ;
189- Ok ( !p. input_mut ( ) . had_line_break_before_cur ( )
189+ !p. input_mut ( ) . had_line_break_before_cur ( )
190190 && p. input_mut ( ) . cur ( ) . is_some_and ( |cur| {
191191 cur. is_lbracket ( )
192192 || cur. is_lbrace ( )
@@ -197,7 +197,7 @@ pub(super) fn ts_next_token_can_follow_modifier<'a>(p: &mut impl Parser<'a>) ->
197197 || cur. is_str ( )
198198 || cur. is_num ( )
199199 || cur. is_bigint ( )
200- } ) )
200+ } )
201201}
202202
203203/// `tsTryParse`
@@ -378,7 +378,7 @@ pub fn parse_ts_modifier<'a, P: Parser<'a>>(
378378 {
379379 return Ok ( None ) ;
380380 }
381- if try_parse_ts_bool ( p, |p| ts_next_token_can_follow_modifier ( p) . map ( Some ) ) ? {
381+ if try_parse_ts_bool ( p, |p| Ok ( Some ( ts_next_token_can_follow_modifier ( p) ) ) ) ? {
382382 return Ok ( Some ( allowed_modifiers[ pos] ) ) ;
383383 }
384384 }
0 commit comments