Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format jstraceable_derive #21373 #21655

Merged
merged 1 commit into from Sep 10, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Format jstraceable_derive #21373

  • Loading branch information
kingdido999
kingdido999 committed Sep 10, 2018
commit 1cd092db63e15d5a06574999cba0d10c81e7fbd5
@@ -3,23 +3,25 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

extern crate quote;
#[macro_use] extern crate syn;
#[macro_use] extern crate synstructure;
#[macro_use]
extern crate syn;
#[macro_use]
extern crate synstructure;

decl_derive!([JSTraceable] => js_traceable_derive);

fn js_traceable_derive(s: synstructure::Structure) -> quote::Tokens {
let match_body = s.each(|binding| {
Some(quote!(#binding.trace(tracer);))
});
let match_body = s.each(|binding| Some(quote!(#binding.trace(tracer);)));

let ast = s.ast();
let name = ast.ident;
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
let mut where_clause = where_clause.unwrap_or(&parse_quote!(where)).clone();
for param in ast.generics.type_params() {
let ident = param.ident;
where_clause.predicates.push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable))
where_clause
.predicates
.push(parse_quote!(#ident: ::dom::bindings::trace::JSTraceable))
}

let tokens = quote! {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.