File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
crates/oxc_parser/src/lexer Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -255,15 +255,21 @@ impl<'a> Lexer<'a> {
255255 return self . escaped_strings [ & token. start ( ) ] ;
256256 }
257257
258- let raw = & self . source . whole ( ) [ token. start ( ) as usize ..token. end ( ) as usize ] ;
258+ let source_text = self . source . whole ( ) ;
259+ let mut start = token. start ( ) as usize ;
260+ let mut end = token. end ( ) as usize ;
259261 match token. kind ( ) {
260262 Kind :: Str => {
261- & raw [ 1 ..raw. len ( ) - 1 ] // omit surrounding quotes
263+ // Omit surrounding quotes
264+ start += 1 ;
265+ end -= 1 ;
262266 }
263267 Kind :: PrivateIdentifier => {
264- & raw [ 1 ..] // omit leading `#`
268+ // Omit leading `#`
269+ start += 1 ;
265270 }
266- _ => raw ,
271+ _ => { }
267272 }
273+ & source_text[ start..end]
268274 }
269275}
You can’t perform that action at this time.
0 commit comments