Skip to content

Commit

Permalink
style: Factor out some of style_derive.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam authored and emilio committed Apr 12, 2019
1 parent f581d2a commit d8a7582
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 9 deletions.
16 changes: 16 additions & 0 deletions components/derive_common/Cargo.toml
@@ -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"
File renamed without changes.
14 changes: 14 additions & 0 deletions components/derive_common/lib.rs
@@ -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;
1 change: 1 addition & 0 deletions components/style_derive/Cargo.toml
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/animate.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/compute_squared_distance.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/lib.rs
Expand Up @@ -6,6 +6,7 @@

#[macro_use]
extern crate darling;
extern crate derive_common;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/parse.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/specified_value_info.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/to_animated_value.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/to_animated_zero.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/to_computed_value.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/style_derive/to_css.rs
Expand Up @@ -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};
Expand Down

0 comments on commit d8a7582

Please sign in to comment.