File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ pub enum CommentKind {
1818 /// Block comment
1919 Block = 1 ,
2020 /// Multiline block comment (contains line breaks)
21+ #[ estree( rename = "Block" ) ]
2122 MultilineBlock = 2 ,
2223}
2324
Original file line number Diff line number Diff line change @@ -83,10 +83,13 @@ impl<'a> Lexer<'a> {
8383 /// Section 12.4 Multi Line Comment
8484 pub ( super ) fn skip_multi_line_comment ( & mut self ) -> Kind {
8585 // If `is_on_new_line` is already set, go directly to faster search which only looks for `*/`
86- // TODO(FIXME): commented out since it doesn't means there is a line break in the comment, while it means the line break is before the comment
87- // if self.token.is_on_new_line() {
88- // return self.skip_multi_line_comment_after_line_break(self.source.position());
89- // }
86+ // We need to identify if comment contains line breaks or not
87+ // (`CommentKind::Block` or `CommentKind::MultilineBlock`).
88+ // So we have to use the loop below for the first line of the comment even if
89+ // `Token`'s `is_on_new_line` flag is already set.
90+ // If the loop finds a line break before end of the comment, we then switch to
91+ // the faster `skip_multi_line_comment_after_line_break` which searches
92+ // for the end of the comment using `memchr`.
9093
9194 byte_search ! {
9295 lexer: self ,
You can’t perform that action at this time.
0 commit comments