File tree Expand file tree Collapse file tree 3 files changed +7
-18
lines changed
crates/swc_ecma_parser/src/lexer Expand file tree Collapse file tree 3 files changed +7
-18
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ swc_core : patch
3+ swc_ecma_parser : patch
4+ ---
5+
6+ perf(es/parser): Remove ` start ` in ` State `
Original file line number Diff line number Diff line change @@ -1212,7 +1212,7 @@ impl<'a> Lexer<'a> {
12121212 }
12131213
12141214 fn read_int_u32 < const RADIX : u8 > ( & mut self , len : u8 ) -> LexResult < Option < u32 > > {
1215- let start = self . state ( ) . start ( ) ;
1215+ let start = self . cur_pos ( ) ;
12161216
12171217 let mut count = 0 ;
12181218 let v = self . read_digits :: < _ , Option < u32 > , RADIX > (
Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ pub struct State {
3434 /// TODO: Remove this field.
3535 is_first : bool ,
3636 pub next_regexp : Option < BytePos > ,
37- pub start : BytePos ,
3837 pub prev_hi : BytePos ,
3938
4039 pub ( super ) token_value : Option < TokenValue > ,
@@ -392,14 +391,6 @@ impl Lexer<'_> {
392391 return Ok ( Token :: Eof ) ;
393392 }
394393
395- // println!(
396- // "\tContext: ({:?}) {:?}",
397- // self.input.cur().unwrap(),
398- // self.state.context.0
399- // );
400-
401- self . state . start = * start;
402-
403394 self . read_token ( )
404395 }
405396
@@ -499,8 +490,6 @@ impl Lexer<'_> {
499490 value : value. into ( ) ,
500491 } ) ;
501492
502- self . state . start = start;
503-
504493 Ok ( Token :: JSXText )
505494 }
506495
@@ -587,7 +576,6 @@ impl State {
587576 had_line_break : false ,
588577 is_first : true ,
589578 next_regexp : None ,
590- start : BytePos ( 0 ) ,
591579 prev_hi : start_pos,
592580 token_value : None ,
593581 token_type : None ,
@@ -625,11 +613,6 @@ impl State {
625613 self . prev_hi
626614 }
627615
628- #[ inline( always) ]
629- pub fn start ( & self ) -> BytePos {
630- self . start
631- }
632-
633616 pub fn can_have_trailing_line_comment ( & self ) -> bool {
634617 let Some ( t) = self . token_type ( ) else {
635618 return true ;
You can’t perform that action at this time.
0 commit comments