refactor(css/ast): Remove unused types (#3465)

This commit is contained in:
Alexander Akait 2022-02-07 15:34:41 +03:00 committed by GitHub
parent 02c401830d
commit 69660fd161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 49 deletions

View File

@ -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")]

View File

@ -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>,

View File

@ -36,8 +36,6 @@ struct Ctx {
allow_operation_in_value: bool,
allow_at_selector: bool,
recover_from_property_value: bool,
}

View File

@ -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()?;

View File

@ -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);

View File

@ -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>,