style: Move represents_keyword to the css attributes.

Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: 21yuU4h34AQ
This commit is contained in:
Emilio Cobos Álvarez 2018-04-29 04:48:47 +02:00
parent a375baf84b
commit c508d8576d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 24 additions and 69 deletions

View file

@ -189,6 +189,15 @@ fn derive_single_field_expr(
writer.item(&item)?;
}
}
} else if attrs.represents_keyword {
let ident =
field.ast().ident.as_ref().expect("Unnamed field with represents_keyword?");
let ident = cg::to_css_identifier(ident.as_ref());
quote! {
if *#field {
writer.raw_item(#ident)?;
}
}
} else {
if attrs.field_bound {
let ty = &field.ast().ty;
@ -236,5 +245,6 @@ pub struct CssFieldAttrs {
pub field_bound: bool,
pub iterable: bool,
pub skip: bool,
pub represents_keyword: bool,
pub skip_if: Option<Path>,
}