mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix deprecated plugin APIs
This commit is contained in:
parent
a0fccea670
commit
8394b82350
3 changed files with 53 additions and 47 deletions
|
@ -5,23 +5,28 @@
|
|||
use syntax::ext::base::{Annotatable, ExtCtxt};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::ptr::P;
|
||||
use syntax::ast::{Item, MetaItem, Expr};
|
||||
use syntax::ast::{MetaItem, Expr};
|
||||
use syntax::ast;
|
||||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct, Substructure, TraitDef, ty};
|
||||
|
||||
pub fn expand_dom_struct(cx: &mut ExtCtxt, _: Span, _: &MetaItem, item: P<Item>) -> P<Item> {
|
||||
let mut item2 = (*item).clone();
|
||||
item2.attrs.push(quote_attr!(cx, #[must_root]));
|
||||
item2.attrs.push(quote_attr!(cx, #[privatize]));
|
||||
item2.attrs.push(quote_attr!(cx, #[jstraceable]));
|
||||
pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotatable) -> Annotatable {
|
||||
if let Annotatable::Item(item) = anno {
|
||||
let mut item2 = (*item).clone();
|
||||
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
|
||||
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)
|
||||
// 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]));
|
||||
Annotatable::Item(P(item2))
|
||||
} else {
|
||||
cx.span_err(sp, "#[dom_struct] applied to something other than a struct");
|
||||
anno
|
||||
}
|
||||
}
|
||||
|
||||
/// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue