Add internal plugin for creating Reflectable implementations

This commit is contained in:
Manish Goregaokar 2014-12-01 10:10:33 -05:00
parent dd8360fb10
commit 21607f066c
4 changed files with 88 additions and 1 deletions

View file

@ -12,7 +12,7 @@
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
//! Use this for structs that correspond to a DOM type
#![feature(macro_rules, plugin_registrar, quote, phase)]
#![feature(macro_rules, plugin_registrar, quote, phase, if_let)]
#![deny(unused_imports)]
#![deny(unused_variables)]
@ -33,12 +33,17 @@ use syntax::parse::token::intern;
// Public for documentation to show up
/// Handles the auto-deriving for `#[jstraceable]`
pub mod jstraceable;
/// Autogenerates implementations of Reflectable on DOM structs
pub mod reflector;
pub mod lints;
/// Utilities for writing plugins
pub mod utils;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(intern("dom_struct"), Modifier(box jstraceable::expand_dom_struct));
reg.register_syntax_extension(intern("jstraceable"), Decorator(box jstraceable::expand_jstraceable));
reg.register_syntax_extension(intern("_generate_reflector"), Decorator(box reflector::expand_reflector));
reg.register_lint_pass(box lints::TransmutePass as LintPassObject);
reg.register_lint_pass(box lints::UnrootedPass as LintPassObject);
reg.register_lint_pass(box lints::PrivatizePass as LintPassObject);