Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(html/parser): raw ast for comment token #6202

Merged
merged 3 commits into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/swc_html_ast/src/token.rs
Expand Up @@ -72,7 +72,7 @@ pub enum Token {
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
data: JsWord,
#[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))]
raw: JsWord,
raw: Option<JsWord>,
},
Character {
value: char,
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_html_parser/src/lexer/mod.rs
Expand Up @@ -826,7 +826,7 @@ where

self.emit_token(Token::Comment {
data: comment.data.into(),
raw: comment.raw.into(),
raw: Some(comment.raw.into()),
});
}

Expand Down
6 changes: 3 additions & 3 deletions crates/swc_html_parser/src/parser/mod.rs
Expand Up @@ -8388,7 +8388,7 @@ where
// node document is the same as that of the node in which the adjusted
// insertion location finds itself.
let (data, raw) = match &token_and_info.token {
Token::Comment { data, raw } => (data.clone(), Some(raw.clone())),
Token::Comment { data, raw } => (data.clone(), raw.clone()),
_ => {
unreachable!()
}
Expand All @@ -8407,7 +8407,7 @@ where
token_and_info: &mut TokenAndInfo,
) -> PResult<()> {
let (data, raw) = match &token_and_info.token {
Token::Comment { data, raw } => (data.clone(), Some(raw.clone())),
Token::Comment { data, raw } => (data.clone(), raw.clone()),
_ => {
unreachable!()
}
Expand All @@ -8427,7 +8427,7 @@ where
token_and_info: &mut TokenAndInfo,
) -> PResult<()> {
let (data, raw) = match &token_and_info.token {
Token::Comment { data, raw } => (data.clone(), Some(raw.clone())),
Token::Comment { data, raw } => (data.clone(), raw.clone()),
_ => {
unreachable!()
}
Expand Down