Skip to content

Commit b63e2a9

Browse files
committed
Move check_for_source_map calls inside consume_comment
1 parent c2f8e1f commit b63e2a9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tokenizer.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ fn next_token<'a>(tokenizer: &mut Tokenizer<'a>) -> Result<Token<'a>, ()> {
514514
}
515515
b'/' => {
516516
if tokenizer.starts_with(b"/*") {
517-
let contents = consume_comment(tokenizer);
518-
check_for_source_map(tokenizer, contents);
519-
Comment(contents)
517+
Comment(consume_comment(tokenizer))
520518
} else {
521519
tokenizer.advance(1);
522520
Delim('/')
@@ -627,7 +625,9 @@ fn consume_comment<'a>(tokenizer: &mut Tokenizer<'a>) -> &'a str {
627625
tokenizer.advance(1);
628626
if tokenizer.next_byte() == Some(b'/') {
629627
tokenizer.advance(1);
630-
return tokenizer.slice(start_position..end_position)
628+
let contents = tokenizer.slice(start_position..end_position);
629+
check_for_source_map(tokenizer, contents);
630+
return contents
631631
}
632632
}
633633
b'\n' | b'\x0C' => {
@@ -643,7 +643,9 @@ fn consume_comment<'a>(tokenizer: &mut Tokenizer<'a>) -> &'a str {
643643
}
644644
}
645645
}
646-
tokenizer.slice_from(start_position)
646+
let contents = tokenizer.slice_from(start_position);
647+
check_for_source_map(tokenizer, contents);
648+
contents
647649
}
648650

649651
fn consume_string<'a>(tokenizer: &mut Tokenizer<'a>, single_quote: bool) -> Token<'a> {

0 commit comments

Comments
 (0)