File tree 2 files changed +6
-7
lines changed
crates/swc_ecma_parser/src 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -768,7 +768,7 @@ impl TokenContexts {
768
768
}
769
769
770
770
#[ inline]
771
- fn push ( & mut self , t : TokenContext ) {
771
+ pub ( crate ) fn push ( & mut self , t : TokenContext ) {
772
772
self . 0 . push ( t) ;
773
773
774
774
if cfg ! ( feature = "debug" ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use swc_atoms::atom;
5
5
use swc_common:: Spanned ;
6
6
7
7
use super :: * ;
8
- use crate :: { lexer :: TokenContexts , parser:: class_and_fn:: IsSimpleParameterList , token:: Keyword } ;
8
+ use crate :: { parser:: class_and_fn:: IsSimpleParameterList , token:: Keyword } ;
9
9
10
10
impl < I : Tokens > Parser < I > {
11
11
/// `tsNextTokenCanFollowModifier`
@@ -2821,12 +2821,11 @@ impl<I: Tokens> Parser<I> {
2821
2821
2822
2822
trace_cur ! ( self , ts_in_no_context__before) ;
2823
2823
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 ) ;
2828
2827
let res = op ( self ) ;
2829
- self . input . set_token_context ( cloned ) ;
2828
+ self . input . set_token_context ( saved ) ;
2830
2829
2831
2830
trace_cur ! ( self , ts_in_no_context__after) ;
2832
2831
You can’t perform that action at this time.
0 commit comments