mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Factor out some of style_derive.
Differential Revision: https://phabricator.services.mozilla.com/D17188
This commit is contained in:
parent
f581d2afb2
commit
d8a758272e
13 changed files with 40 additions and 9 deletions
16
components/derive_common/Cargo.toml
Normal file
16
components/derive_common/Cargo.toml
Normal 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"
|
14
components/derive_common/lib.rs
Normal file
14
components/derive_common/lib.rs
Normal 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;
|
|
@ -11,6 +11,7 @@ proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
darling = "0.8"
|
darling = "0.8"
|
||||||
|
derive_common = { path = "../derive_common" }
|
||||||
proc-macro2 = "0.4"
|
proc-macro2 = "0.4"
|
||||||
quote = "0.6"
|
quote = "0.6"
|
||||||
syn = { version = "0.15", features = ["visit"] }
|
syn = { version = "0.15", features = ["visit"] }
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::cg;
|
|
||||||
use darling::util::IdentList;
|
use darling::util::IdentList;
|
||||||
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{DeriveInput, Path, WhereClause};
|
use syn::{DeriveInput, Path, WhereClause};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||||
use crate::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{DeriveInput, Path};
|
use syn::{DeriveInput, Path};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate darling;
|
extern crate darling;
|
||||||
|
extern crate derive_common;
|
||||||
extern crate proc_macro;
|
extern crate proc_macro;
|
||||||
extern crate proc_macro2;
|
extern crate proc_macro2;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -17,7 +18,6 @@ extern crate synstructure;
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
mod animate;
|
mod animate;
|
||||||
mod cg;
|
|
||||||
mod compute_squared_distance;
|
mod compute_squared_distance;
|
||||||
mod parse;
|
mod parse;
|
||||||
mod specified_value_info;
|
mod specified_value_info;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::cg;
|
|
||||||
use crate::to_css::CssVariantAttrs;
|
use crate::to_css::CssVariantAttrs;
|
||||||
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use syn::{self, DeriveInput, Path};
|
use syn::{self, DeriveInput, Path};
|
||||||
use synstructure::{Structure, VariantInfo};
|
use synstructure::{Structure, VariantInfo};
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::cg;
|
|
||||||
use crate::parse::ParseVariantAttrs;
|
use crate::parse::ParseVariantAttrs;
|
||||||
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
|
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
|
||||||
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{Data, DeriveInput, Fields, Ident, Type};
|
use syn::{Data, DeriveInput, Fields, Ident, Type};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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 proc_macro2::{Span, TokenStream};
|
||||||
use syn::{DeriveInput, Ident};
|
use syn::{DeriveInput, Ident};
|
||||||
use synstructure::BindStyle;
|
use synstructure::BindStyle;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||||
use crate::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn;
|
use syn;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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 proc_macro2::{Span, TokenStream};
|
||||||
use syn::{DeriveInput, Ident};
|
use syn::{DeriveInput, Ident};
|
||||||
use synstructure::BindStyle;
|
use synstructure::BindStyle;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::cg;
|
|
||||||
use darling::util::Override;
|
use darling::util::Override;
|
||||||
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::{ToTokens, TokenStreamExt};
|
use quote::{ToTokens, TokenStreamExt};
|
||||||
use syn::{self, Data, Path, WhereClause};
|
use syn::{self, Data, Path, WhereClause};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue