mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove the Option<Self> arguments from IDLInterface.
This commit is contained in:
parent
dc31d96f65
commit
c58213b698
2 changed files with 6 additions and 8 deletions
|
@ -1920,10 +1920,10 @@ class CGIDLInterface(CGThing):
|
|||
}
|
||||
return string.Template("""\
|
||||
impl IDLInterface for ${type} {
|
||||
fn get_prototype_id(_: Option<${type}>) -> PrototypeList::ID {
|
||||
fn get_prototype_id() -> PrototypeList::ID {
|
||||
PrototypeList::ID::${type}
|
||||
}
|
||||
fn get_prototype_depth(_: Option<${type}>) -> uint {
|
||||
fn get_prototype_depth() -> uint {
|
||||
${depth}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,14 +57,12 @@ use std::slice;
|
|||
|
||||
/// A trait to retrieve the constants necessary to check if a `JSObject`
|
||||
/// implements a given interface.
|
||||
// FIXME (https://github.com/rust-lang/rfcs/pull/4)
|
||||
// remove Option<Self> arguments.
|
||||
pub trait IDLInterface {
|
||||
/// Returns the prototype ID.
|
||||
fn get_prototype_id(_: Option<Self>) -> PrototypeList::ID;
|
||||
fn get_prototype_id() -> PrototypeList::ID;
|
||||
/// Returns the prototype depth, i.e., the number of interfaces this
|
||||
/// interface inherits from.
|
||||
fn get_prototype_depth(_: Option<Self>) -> uint;
|
||||
fn get_prototype_depth() -> uint;
|
||||
}
|
||||
|
||||
/// A trait to convert Rust types to `JSVal`s.
|
||||
|
@ -489,8 +487,8 @@ pub fn unwrap_jsmanaged<T>(mut obj: *mut JSObject) -> Result<Unrooted<T>, ()>
|
|||
}
|
||||
}));
|
||||
|
||||
let proto_id = IDLInterface::get_prototype_id(None::<T>);
|
||||
let proto_depth = IDLInterface::get_prototype_depth(None::<T>);
|
||||
let proto_id = <T as IDLInterface>::get_prototype_id();
|
||||
let proto_depth = <T as IDLInterface>::get_prototype_depth();
|
||||
if dom_class.interface_chain[proto_depth] == proto_id {
|
||||
debug!("good prototype");
|
||||
Ok(Unrooted::from_raw(unwrap(obj)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue