File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
crates/swc_ecma_parser/src Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -768,7 +768,7 @@ impl TokenContexts {
768768 }
769769
770770 #[ inline]
771- fn push ( & mut self , t : TokenContext ) {
771+ pub ( crate ) fn push ( & mut self , t : TokenContext ) {
772772 self . 0 . push ( t) ;
773773
774774 if cfg ! ( feature = "debug" ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use swc_atoms::atom;
55use swc_common:: Spanned ;
66
77use super :: * ;
8- use crate :: { lexer :: TokenContexts , parser:: class_and_fn:: IsSimpleParameterList , token:: Keyword } ;
8+ use crate :: { parser:: class_and_fn:: IsSimpleParameterList , token:: Keyword } ;
99
1010impl < I : Tokens > Parser < I > {
1111 /// `tsNextTokenCanFollowModifier`
@@ -2821,12 +2821,11 @@ impl<I: Tokens> Parser<I> {
28212821
28222822 trace_cur ! ( self , ts_in_no_context__before) ;
28232823
2824- let cloned = self . input . token_context ( ) . clone ( ) ;
2825-
2826- self . input
2827- . set_token_context ( TokenContexts ( smallvec:: smallvec![ cloned. 0 [ 0 ] ] ) ) ;
2824+ let saved = std:: mem:: take ( self . input . token_context_mut ( ) ) ;
2825+ self . input . token_context_mut ( ) . push ( saved. 0 [ 0 ] ) ;
2826+ debug_assert_eq ! ( self . input. token_context( ) . len( ) , 1 ) ;
28282827 let res = op ( self ) ;
2829- self . input . set_token_context ( cloned ) ;
2828+ self . input . set_token_context ( saved ) ;
28302829
28312830 trace_cur ! ( self , ts_in_no_context__after) ;
28322831
You can’t perform that action at this time.
0 commit comments