mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
feat(html/ast): Add raw
to comment tokens (#6202)
This commit is contained in:
parent
6008995db1
commit
99ea28674a
@ -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,
|
||||
|
@ -826,7 +826,7 @@ where
|
||||
|
||||
self.emit_token(Token::Comment {
|
||||
data: comment.data.into(),
|
||||
raw: comment.raw.into(),
|
||||
raw: Some(comment.raw.into()),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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!()
|
||||
}
|
||||
@ -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!()
|
||||
}
|
||||
@ -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!()
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use std::{fs, mem::take, path::PathBuf};
|
||||
|
||||
use common::{document_span_visualizer, DomVisualizer};
|
||||
use serde_json::Value;
|
||||
use swc_atoms::{js_word, JsWord};
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{
|
||||
collections::AHashSet,
|
||||
input::{SourceFileInput, StringInput},
|
||||
@ -210,7 +210,7 @@ fn html5lib_test_tokenizer(input: PathBuf) {
|
||||
*raw = None;
|
||||
}
|
||||
Token::Comment { ref mut raw, .. } => {
|
||||
*raw = js_word!("");
|
||||
*raw = None;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -355,7 +355,7 @@ fn html5lib_test_tokenizer(input: PathBuf) {
|
||||
|
||||
vec![Token::Comment {
|
||||
data: data.into(),
|
||||
raw: js_word!(""),
|
||||
raw: None,
|
||||
}]
|
||||
}
|
||||
_ => {
|
||||
|
Loading…
Reference in New Issue
Block a user