forked from mirrors/gecko-dev
		
	 ba474011c0
			
		
	
	
		ba474011c0
		
	
	
	
	
		
			
			Source-Repo: https://github.com/servo/servo Source-Revision: a099d27f99dadf3f7c26d997e43c1a12e0c5bd0e --HG-- rename : servo/components/plugins/lints/ban.rs => servo/components/script_plugins/ban.rs rename : servo/components/plugins/jstraceable.rs => servo/components/script_plugins/jstraceable.rs rename : servo/components/plugins/lib.rs => servo/components/script_plugins/lib.rs rename : servo/components/plugins/lints/unrooted_must_root.rs => servo/components/script_plugins/unrooted_must_root.rs rename : servo/components/plugins/utils.rs => servo/components/script_plugins/utils.rs extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : d9f5feb6fec348aa13107d51c21f3a7861c37eee
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| /* 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 http://mozilla.org/MPL/2.0/. */
 | |
| 
 | |
| use syntax::ast::MetaItem;
 | |
| use syntax::codemap::Span;
 | |
| use syntax::ext::base::{Annotatable, ExtCtxt};
 | |
| use syntax::ptr::P;
 | |
| 
 | |
| 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, #[repr(C)]));
 | |
|         item2.attrs.push(quote_attr!(cx, #[derive(JSTraceable)]));
 | |
|         item2.attrs.push(quote_attr!(cx, #[derive(HeapSizeOf)]));
 | |
|         item2.attrs.push(quote_attr!(cx, #[derive(DenyPublicFields)]));
 | |
|         item2.attrs.push(quote_attr!(cx, #[derive(DomObject)]));
 | |
|         Annotatable::Item(P(item2))
 | |
|     } else {
 | |
|         cx.span_err(sp, "#[dom_struct] applied to something other than a struct");
 | |
|         anno
 | |
|     }
 | |
| }
 |