mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
refactor(css/ast): Remove unused types (#3465)
This commit is contained in:
parent
02c401830d
commit
69660fd161
@ -113,9 +113,6 @@ pub enum SubclassSelector {
|
||||
|
||||
#[tag("PseudoElementSelector")]
|
||||
PseudoElement(PseudoElementSelector),
|
||||
|
||||
#[tag("AtSelector")]
|
||||
At(AtSelector),
|
||||
}
|
||||
|
||||
#[ast_node("IdSelector")]
|
||||
@ -197,13 +194,6 @@ pub struct PseudoElementSelector {
|
||||
pub children: Option<Tokens>,
|
||||
}
|
||||
|
||||
/// Type for `@top-center`. Allowwed in only some contexts.
|
||||
#[ast_node("AtSelector")]
|
||||
pub struct AtSelector {
|
||||
pub span: Span,
|
||||
pub text: Ident,
|
||||
}
|
||||
|
||||
#[ast_node]
|
||||
pub enum PseudoSelectorChildren {
|
||||
#[tag("Nth")]
|
||||
|
@ -1298,7 +1298,6 @@ where
|
||||
SubclassSelector::Attribute(n) => emit!(self, n),
|
||||
SubclassSelector::PseudoClass(n) => emit!(self, n),
|
||||
SubclassSelector::PseudoElement(n) => emit!(self, n),
|
||||
SubclassSelector::At(n) => emit!(self, n),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1460,12 +1459,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[emitter]
|
||||
fn emit_at_selector(&mut self, n: &AtSelector) -> Result {
|
||||
punct!(self, "@");
|
||||
emit!(self, n.text);
|
||||
}
|
||||
|
||||
fn emit_list<N>(&mut self, nodes: &[N], format: ListFormat) -> Result
|
||||
where
|
||||
Self: Emit<N>,
|
||||
|
@ -36,8 +36,6 @@ struct Ctx {
|
||||
|
||||
allow_operation_in_value: bool,
|
||||
|
||||
allow_at_selector: bool,
|
||||
|
||||
recover_from_property_value: bool,
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,7 @@ where
|
||||
if !(is!(self, "#")
|
||||
|| is!(self, ".")
|
||||
|| is!(self, "[")
|
||||
|| (is!(self, ":") && !peeked_is!(self, ":"))
|
||||
// TODO remove `@`
|
||||
|| is!(self, "@"))
|
||||
|| (is!(self, ":") && !peeked_is!(self, ":")))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -340,26 +338,6 @@ where
|
||||
tok!(".") => Ok(SubclassSelector::Class(self.parse()?)),
|
||||
tok!("[") => Ok(SubclassSelector::Attribute(self.parse()?)),
|
||||
tok!(":") => Ok(SubclassSelector::PseudoClass(self.parse()?)),
|
||||
// TODO remove me from here
|
||||
Token::AtKeyword { .. } if self.ctx.allow_at_selector => {
|
||||
let span = self.input.cur_span()?;
|
||||
|
||||
let values = match bump!(self) {
|
||||
Token::AtKeyword { value, raw } => (value, raw),
|
||||
_ => {
|
||||
unreachable!()
|
||||
}
|
||||
};
|
||||
|
||||
Ok(SubclassSelector::At(AtSelector {
|
||||
span,
|
||||
text: Ident {
|
||||
span,
|
||||
value: values.0,
|
||||
raw: values.1,
|
||||
},
|
||||
}))
|
||||
}
|
||||
_ => {
|
||||
let span = self.input.cur_span()?;
|
||||
|
||||
|
@ -280,7 +280,6 @@ macro_rules! mtd {
|
||||
|
||||
impl Visit for SpanVisualizer<'_> {
|
||||
mtd!(AtRule, visit_at_rule);
|
||||
mtd!(AtSelector, visit_at_selector);
|
||||
mtd!(BinValue, visit_bin_value);
|
||||
mtd!(SelectorList, visit_selector_list);
|
||||
mtd!(ComplexSelector, visit_complex_selector);
|
||||
|
@ -262,7 +262,6 @@ define!({
|
||||
Attribute(AttributeSelector),
|
||||
PseudoClass(PseudoClassSelector),
|
||||
PseudoElement(PseudoElementSelector),
|
||||
At(AtSelector),
|
||||
}
|
||||
|
||||
pub struct AttributeSelector {
|
||||
@ -336,11 +335,6 @@ define!({
|
||||
pub text: Ident,
|
||||
}
|
||||
|
||||
pub struct AtSelector {
|
||||
pub span: Span,
|
||||
pub text: Ident,
|
||||
}
|
||||
|
||||
pub struct Stylesheet {
|
||||
pub span: Span,
|
||||
pub rules: Vec<Rule>,
|
||||
|
Loading…
Reference in New Issue
Block a user