style: Factor out some of style_derive.

Differential Revision: https://phabricator.services.mozilla.com/D17188
This commit is contained in:
Cameron McCormack 2019-03-30 00:16:01 +00:00 committed by Emilio Cobos Álvarez
parent f581d2afb2
commit d8a758272e
13 changed files with 40 additions and 9 deletions

View file

@ -0,0 +1,16 @@
[package]
name = "derive_common"
version = "0.0.1"
authors = ["The Servo Project Developers"]
license = "MPL-2.0"
publish = false
[lib]
path = "lib.rs"
[dependencies]
darling = "0.8"
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "0.15", features = ["visit"] }
synstructure = "0.10"

View file

@ -0,0 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
extern crate darling;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate syn;
extern crate synstructure;
pub mod cg;

View file

@ -11,6 +11,7 @@ proc-macro = true
[dependencies]
darling = "0.8"
derive_common = { path = "../derive_common" }
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "0.15", features = ["visit"] }

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use darling::util::IdentList;
use derive_common::cg;
use proc_macro2::TokenStream;
use quote::TokenStreamExt;
use syn::{DeriveInput, Path, WhereClause};

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
use crate::cg;
use derive_common::cg;
use proc_macro2::TokenStream;
use quote::TokenStreamExt;
use syn::{DeriveInput, Path};

View file

@ -6,6 +6,7 @@
#[macro_use]
extern crate darling;
extern crate derive_common;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
@ -17,7 +18,6 @@ extern crate synstructure;
use proc_macro::TokenStream;
mod animate;
mod cg;
mod compute_squared_distance;
mod parse;
mod specified_value_info;

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use crate::to_css::CssVariantAttrs;
use derive_common::cg;
use proc_macro2::TokenStream;
use syn::{self, DeriveInput, Path};
use synstructure::{Structure, VariantInfo};

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use crate::parse::ParseVariantAttrs;
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
use derive_common::cg;
use proc_macro2::TokenStream;
use quote::TokenStreamExt;
use syn::{Data, DeriveInput, Fields, Ident, Type};

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use derive_common::cg;
use proc_macro2::{Span, TokenStream};
use syn::{DeriveInput, Ident};
use synstructure::BindStyle;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
use crate::cg;
use derive_common::cg;
use proc_macro2::TokenStream;
use quote::TokenStreamExt;
use syn;

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use derive_common::cg;
use proc_macro2::{Span, TokenStream};
use syn::{DeriveInput, Ident};
use synstructure::BindStyle;

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cg;
use darling::util::Override;
use derive_common::cg;
use proc_macro2::TokenStream;
use quote::{ToTokens, TokenStreamExt};
use syn::{self, Data, Path, WhereClause};