Add inheritance-checking lint

This commit is contained in:
Manish Goregaokar 2014-12-01 14:13:50 -05:00
parent 7d65673561
commit d761877ef6
9 changed files with 139 additions and 21 deletions

View file

@ -346,9 +346,12 @@ pub fn reflect_dom_object<T: Reflectable>
}
/// A struct to store a reference to the reflector of a DOM object.
#[allow(raw_pointer_deriving, unrooted_must_root)]
// Allowing unused_attribute because the lint sometimes doesn't run in order
#[allow(raw_pointer_deriving, unrooted_must_root, unused_attributes)]
#[deriving(PartialEq)]
#[must_root]
#[servo_lang = "reflector"]
// If you're renaming or moving this field, update the path in plugins::reflector as well
pub struct Reflector {
object: Cell<*mut JSObject>,
}

View file

@ -65,7 +65,9 @@ impl BrowserContext {
}
}
#[dom_struct]
#[must_root]
#[privatize]
#[jstraceable]
pub struct SessionHistoryEntry {
document: JS<Document>,
children: Vec<BrowserContext>

View file

@ -12,7 +12,7 @@ use dom::bindings::js::{JSRef, Temporary, MutHeap};
use js::jsapi::JSContext;
use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::utils::reflect_dom_object;
use dom::event::{Event, EventTypeId, EventBubbles, EventCancelable};
use servo_util::str::DOMString;
@ -127,9 +127,3 @@ impl<'a> ErrorEventMethods for JSRef<'a, ErrorEvent> {
}
}
impl Reflectable for ErrorEvent {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.event.reflector()
}
}

View file

@ -240,3 +240,12 @@ impl<'a> EventMethods for JSRef<'a, Event> {
}
}
pub trait EventHelpers {
fn set_trusted(self, trusted: bool);
}
impl<'a> EventHelpers for JSRef<'a, Event> {
fn set_trusted(self, trusted: bool) {
self.trusted.set(trusted);
}
}