Skip to content

Commit e3be49b

Browse files
committed
Revert "Revert legacy"
This reverts commit 4f12659.
1 parent ddec042 commit e3be49b

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

crates/swc_ecma_lexer/src/lexer/comments_buffer.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ impl CommentsBuffer {
2525
pending_leading: OneDirectionalList::new(),
2626
}
2727
}
28-
29-
pub fn take_pending_leading(&mut self) -> Rev<IntoIter<Comment>> {
30-
self.pending_leading.take_all()
31-
}
3228
}
3329

3430
impl CommentsBufferTrait for CommentsBuffer {

crates/swc_ecma_lexer/src/lexer/state.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
input::Tokens,
1212
lexer::{
1313
char::CharExt,
14-
comments_buffer::{BufferedComment, BufferedCommentKind, CommentsBufferTrait},
14+
comments_buffer::{BufferedCommentKind, CommentsBufferTrait},
1515
state::{
1616
State as StateTrait, TokenKind as TokenKindTrait, TokenType as TokenTypeTrait,
1717
},
@@ -870,13 +870,7 @@ impl Iterator for Lexer<'_> {
870870
let span = self.span(start);
871871
if !matches!(token, Token::Eof) {
872872
if let Some(comments) = self.comments_buffer.as_mut() {
873-
for comment in comments.take_pending_leading() {
874-
comments.push_comment(BufferedComment {
875-
kind: BufferedCommentKind::Leading,
876-
pos: start,
877-
comment,
878-
});
879-
}
873+
comments.pending_to_comment(BufferedCommentKind::Leading, start);
880874
}
881875

882876
self.state.update(start, token.kind());

0 commit comments

Comments
 (0)