mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Rename #[parse(aliases)] to #[css(aliases)]
This commit is contained in:
parent
3fba02a0d6
commit
579cef6a69
4 changed files with 12 additions and 18 deletions
|
@ -28,9 +28,9 @@ pub enum Display {
|
|||
Table, InlineTable, TableRowGroup, TableHeaderGroup,
|
||||
TableFooterGroup, TableRow, TableColumnGroup,
|
||||
TableColumn, TableCell, TableCaption, ListItem, None,
|
||||
#[parse(aliases = "-webkit-flex")]
|
||||
#[css(aliases = "-webkit-flex")]
|
||||
Flex,
|
||||
#[parse(aliases = "-webkit-inline-flex")]
|
||||
#[css(aliases = "-webkit-inline-flex")]
|
||||
InlineFlex,
|
||||
#[cfg(feature = "gecko")]
|
||||
Grid,
|
||||
|
|
|
@ -39,7 +39,7 @@ pub fn derive_to_animated_value(stream: TokenStream) -> TokenStream {
|
|||
to_animated_value::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(Parse, attributes(parse))]
|
||||
#[proc_macro_derive(Parse, attributes(css))]
|
||||
pub fn derive_parse(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
parse::derive(input).to_string().parse().unwrap()
|
||||
|
|
|
@ -6,6 +6,7 @@ use cg;
|
|||
use quote::Tokens;
|
||||
use syn::DeriveInput;
|
||||
use synstructure;
|
||||
use to_css::CssVariantAttrs;
|
||||
|
||||
pub fn derive(input: DeriveInput) -> Tokens {
|
||||
let name = &input.ident;
|
||||
|
@ -19,7 +20,7 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
"Parse is only supported for single-variant enums for now"
|
||||
);
|
||||
|
||||
let variant_attrs = cg::parse_variant_attrs::<ParseVariantAttrs>(variant);
|
||||
let variant_attrs = cg::parse_variant_attrs::<CssVariantAttrs>(variant);
|
||||
let identifier = cg::to_css_identifier(variant.ident.as_ref());
|
||||
let ident = &variant.ident;
|
||||
|
||||
|
@ -87,11 +88,3 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
#methods_impl
|
||||
}
|
||||
}
|
||||
|
||||
#[darling(attributes(parse), default)]
|
||||
#[derive(Default, FromVariant)]
|
||||
struct ParseVariantAttrs {
|
||||
/// The comma-separated list of aliases this variant should be aliased to at
|
||||
/// parse time.
|
||||
aliases: Option<String>,
|
||||
}
|
||||
|
|
|
@ -123,11 +123,12 @@ struct CssInputAttrs {
|
|||
|
||||
#[darling(attributes(css), default)]
|
||||
#[derive(Default, FromVariant)]
|
||||
struct CssVariantAttrs {
|
||||
function: Option<Function>,
|
||||
iterable: bool,
|
||||
comma: bool,
|
||||
dimension: bool,
|
||||
pub struct CssVariantAttrs {
|
||||
pub function: Option<Function>,
|
||||
pub iterable: bool,
|
||||
pub comma: bool,
|
||||
pub dimension: bool,
|
||||
pub aliases: Option<String>,
|
||||
}
|
||||
|
||||
#[darling(attributes(css), default)]
|
||||
|
@ -136,7 +137,7 @@ struct CssFieldAttrs {
|
|||
ignore_bound: bool,
|
||||
}
|
||||
|
||||
struct Function {
|
||||
pub struct Function {
|
||||
name: Option<Ident>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue