diff --git a/components/plugins/jstraceable.rs b/components/plugins/jstraceable.rs index cf0089c7f71..9384ed2038c 100644 --- a/components/plugins/jstraceable.rs +++ b/components/plugins/jstraceable.rs @@ -7,27 +7,20 @@ use syntax::codemap::Span; use syntax::ptr::P; use syntax::ast::{Item, MetaItem, Expr}; use syntax::ast; -use syntax::attr; use syntax::ext::build::AstBuilder; use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct, Substructure, TraitDef, ty}; -use syntax::parse::token::InternedString; -pub fn expand_dom_struct(_: &mut ExtCtxt, _: Span, _: &MetaItem, item: P) -> P { +pub fn expand_dom_struct(cx: &mut ExtCtxt, _: Span, _: &MetaItem, item: P) -> P { let mut item2 = (*item).clone(); - { - let mut add_attr = |s| { - item2.attrs.push(attr::mk_attr_outer(attr::mk_attr_id(), attr::mk_word_item(InternedString::new(s)))); - }; - add_attr("must_root"); - add_attr("privatize"); - add_attr("jstraceable"); + item2.attrs.push(quote_attr!(cx, #[must_root])); + item2.attrs.push(quote_attr!(cx, #[privatize])); + item2.attrs.push(quote_attr!(cx, #[jstraceable])); - // The following attributes are only for internal usage - add_attr("_generate_reflector"); - // #[dom_struct] gets consumed, so this lets us keep around a residue - // Do NOT register a modifier/decorator on this attribute - add_attr("_dom_struct_marker"); - } + // The following attributes are only for internal usage + item2.attrs.push(quote_attr!(cx, #[_generate_reflector])); + // #[dom_struct] gets consumed, so this lets us keep around a residue + // Do NOT register a modifier/decorator on this attribute + item2.attrs.push(quote_attr!(cx, #[_dom_struct_marker])); P(item2) } @@ -48,9 +41,7 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: explicit_self: ty::borrowed_explicit_self(), args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))), ty::Raw(ast::MutMutable))), ret_ty: ty::nil_ty(), - attributes: vec!(attr::mk_attr_outer(attr::mk_attr_id(), - attr::mk_name_value_item_str(InternedString::new("inline"), - InternedString::new("always")))), + attributes: vec![quote_attr!(cx, #[inline(always)])], combine_substructure: combine_substructure(box jstraceable_substructure) } ],