more refactoring

This commit is contained in:
rohan.prinja 2015-10-27 17:58:34 +09:00
parent bb2536cd01
commit 45224028db
115 changed files with 3387 additions and 354 deletions

View file

@ -16,13 +16,13 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
let struct_name = item.ident;
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time
match def.fields.iter().find(
|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "utils", "Reflector"]).is_some()) {
|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "reflector", "Reflector"]).is_some()) {
// If it has a field that is a Reflector, use that
Some(f) => {
let field_name = f.node.ident();
let impl_item = quote_item!(cx,
impl ::dom::bindings::utils::Reflectable for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::utils::Reflector {
impl ::dom::bindings::reflector::Reflectable for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
&self.$field_name
}
fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) {
@ -36,8 +36,8 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
None => {
let field_name = def.fields[0].node.ident();
let impl_item = quote_item!(cx,
impl ::dom::bindings::utils::Reflectable for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::utils::Reflector {
impl ::dom::bindings::reflector::Reflectable for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
self.$field_name.reflector()
}
fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) {