mirror of
https://github.com/servo/servo.git
synced 2025-06-20 23:28:59 +01:00
Introduce mutable/immutable variants of reflector() with named lifetimes, and kill unsafe casts.
This commit is contained in:
parent
e6be738d97
commit
c4bbc4cd37
24 changed files with 158 additions and 87 deletions
|
@ -144,9 +144,15 @@ impl ReflectableDocument for Document {
|
|||
}
|
||||
|
||||
impl Reflectable for AbstractDocument {
|
||||
fn reflector(&mut self) -> &mut Reflector {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
do self.with_mut_base |doc| {
|
||||
doc.reflector()
|
||||
unsafe { cast::transmute(doc.reflector()) }
|
||||
}
|
||||
}
|
||||
|
||||
fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
|
||||
do self.with_mut_base |doc| {
|
||||
unsafe { cast::transmute(doc.mut_reflector()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,10 +191,12 @@ impl DerivedWrapper for AbstractDocument {
|
|||
|
||||
|
||||
impl Reflectable for Document {
|
||||
fn reflector(&mut self) -> &mut Reflector {
|
||||
unsafe {
|
||||
cast::transmute(&self.reflector_)
|
||||
}
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
&self.reflector_
|
||||
}
|
||||
|
||||
fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
|
||||
&mut self.reflector_
|
||||
}
|
||||
|
||||
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue