mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Rename the PrototypeList enums to fix case build warnings.
This commit is contained in:
parent
d7b3900431
commit
e2b75670bd
3 changed files with 19 additions and 20 deletions
|
@ -104,8 +104,8 @@ class CastableObjectUnwrapper():
|
||||||
self.substitution = {
|
self.substitution = {
|
||||||
"type": descriptor.nativeType,
|
"type": descriptor.nativeType,
|
||||||
"depth": descriptor.interface.inheritanceDepth(),
|
"depth": descriptor.interface.inheritanceDepth(),
|
||||||
"prototype": "PrototypeList::id::" + descriptor.name,
|
"prototype": "PrototypeList::ID::" + descriptor.name,
|
||||||
"protoID": "PrototypeList::id::" + descriptor.name + " as uint",
|
"protoID": "PrototypeList::ID::" + descriptor.name + " as uint",
|
||||||
"source": source,
|
"source": source,
|
||||||
"codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
|
"codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
|
||||||
}
|
}
|
||||||
|
@ -1418,12 +1418,12 @@ class CGNamespace(CGWrapper):
|
||||||
return CGNamespace(namespaces[0], inner, public=public)
|
return CGNamespace(namespaces[0], inner, public=public)
|
||||||
|
|
||||||
def DOMClass(descriptor):
|
def DOMClass(descriptor):
|
||||||
protoList = ['PrototypeList::id::' + proto for proto in descriptor.prototypeChain]
|
protoList = ['PrototypeList::ID::' + proto for proto in descriptor.prototypeChain]
|
||||||
# Pad out the list to the right length with id::Count so we
|
# Pad out the list to the right length with ID::Count so we
|
||||||
# guarantee that all the lists are the same length. id::Count
|
# guarantee that all the lists are the same length. id::Count
|
||||||
# is never the ID of any prototype, so it's safe to use as
|
# is never the ID of any prototype, so it's safe to use as
|
||||||
# padding.
|
# padding.
|
||||||
protoList.extend(['PrototypeList::id::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
protoList.extend(['PrototypeList::ID::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
|
||||||
prototypeChainString = ', '.join(protoList)
|
prototypeChainString = ', '.join(protoList)
|
||||||
return """DOMClass {
|
return """DOMClass {
|
||||||
interface_chain: [ %s ],
|
interface_chain: [ %s ],
|
||||||
|
@ -1801,7 +1801,7 @@ def CreateBindingJSObject(descriptor, parent=None):
|
||||||
if descriptor.proxy:
|
if descriptor.proxy:
|
||||||
assert not descriptor.isGlobal()
|
assert not descriptor.isGlobal()
|
||||||
create += """
|
create += """
|
||||||
let handler = RegisterBindings::proxy_handlers[PrototypeList::proxies::%s as uint];
|
let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as uint];
|
||||||
let mut private = PrivateValue(squirrel_away_unique(aObject) as *const libc::c_void);
|
let mut private = PrivateValue(squirrel_away_unique(aObject) as *const libc::c_void);
|
||||||
let obj = with_compartment(aCx, proto, || {
|
let obj = with_compartment(aCx, proto, || {
|
||||||
NewProxyObject(aCx, handler,
|
NewProxyObject(aCx, handler,
|
||||||
|
@ -1887,8 +1887,8 @@ class CGIDLInterface(CGThing):
|
||||||
}
|
}
|
||||||
return string.Template("""
|
return string.Template("""
|
||||||
impl IDLInterface for ${type} {
|
impl IDLInterface for ${type} {
|
||||||
fn get_prototype_id(_: Option<${type}>) -> PrototypeList::id {
|
fn get_prototype_id(_: Option<${type}>) -> PrototypeList::ID {
|
||||||
PrototypeList::id::${type}
|
PrototypeList::ID::${type}
|
||||||
}
|
}
|
||||||
fn get_prototype_depth(_: Option<${type}>) -> uint {
|
fn get_prototype_depth(_: Option<${type}>) -> uint {
|
||||||
${depth}
|
${depth}
|
||||||
|
@ -2023,7 +2023,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
|
||||||
Argument('*mut JSObject', 'aReceiver')]
|
Argument('*mut JSObject', 'aReceiver')]
|
||||||
CGAbstractMethod.__init__(self, descriptor, name,
|
CGAbstractMethod.__init__(self, descriptor, name,
|
||||||
'*mut JSObject', args, pub=pub)
|
'*mut JSObject', args, pub=pub)
|
||||||
self.id = idPrefix + "id::" + self.descriptor.name
|
self.id = idPrefix + "ID::" + self.descriptor.name
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return CGGeneric("""
|
return CGGeneric("""
|
||||||
|
|
||||||
|
@ -2682,7 +2682,7 @@ class CGMemberJITInfo(CGThing):
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
|
|
||||||
def defineJitInfo(self, infoName, opName, infallible):
|
def defineJitInfo(self, infoName, opName, infallible):
|
||||||
protoID = "PrototypeList::id::%s as u32" % self.descriptor.name
|
protoID = "PrototypeList::ID::%s as u32" % self.descriptor.name
|
||||||
depth = self.descriptor.interface.inheritanceDepth()
|
depth = self.descriptor.interface.inheritanceDepth()
|
||||||
failstr = "true" if infallible else "false"
|
failstr = "true" if infallible else "false"
|
||||||
return ("\n"
|
return ("\n"
|
||||||
|
@ -4397,7 +4397,7 @@ class CGRegisterProxyHandlersMethod(CGAbstractMethod):
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return CGList([
|
return CGList([
|
||||||
CGGeneric("proxy_handlers[proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
|
CGGeneric("proxy_handlers[Proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
|
||||||
for desc in self.descriptors
|
for desc in self.descriptors
|
||||||
], "\n")
|
], "\n")
|
||||||
|
|
||||||
|
@ -5135,8 +5135,8 @@ class GlobalGenRoots():
|
||||||
return CGList([
|
return CGList([
|
||||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||||
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||||
CGNonNamespacedEnum('id', protos, [0], deriving="PartialEq"),
|
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq"),
|
||||||
CGNonNamespacedEnum('proxies', proxies, [0], deriving="PartialEq"),
|
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq"),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -5150,7 +5150,7 @@ class GlobalGenRoots():
|
||||||
|
|
||||||
return CGImports(code, [], [
|
return CGImports(code, [], [
|
||||||
'dom::bindings::codegen',
|
'dom::bindings::codegen',
|
||||||
'dom::bindings::codegen::PrototypeList::proxies',
|
'dom::bindings::codegen::PrototypeList::Proxies',
|
||||||
'js::jsapi::JSContext',
|
'js::jsapi::JSContext',
|
||||||
'js::jsapi::JSObject',
|
'js::jsapi::JSObject',
|
||||||
'libc',
|
'libc',
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
//! Conversions of Rust values to and from `JSVal`.
|
//! Conversions of Rust values to and from `JSVal`.
|
||||||
|
|
||||||
|
use dom::bindings::codegen::PrototypeList;
|
||||||
use dom::bindings::js::{JS, JSRef, Root};
|
use dom::bindings::js::{JS, JSRef, Root};
|
||||||
use dom::bindings::str::ByteString;
|
use dom::bindings::str::ByteString;
|
||||||
use dom::bindings::utils::{Reflectable, Reflector};
|
use dom::bindings::utils::{Reflectable, Reflector};
|
||||||
|
@ -29,15 +30,13 @@ use libc;
|
||||||
use std::default;
|
use std::default;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use dom::bindings::codegen::PrototypeList;
|
|
||||||
|
|
||||||
/// A trait to retrieve the constants necessary to check if a `JSObject`
|
/// A trait to retrieve the constants necessary to check if a `JSObject`
|
||||||
/// implements a given interface.
|
/// implements a given interface.
|
||||||
// FIXME (https://github.com/rust-lang/rfcs/pull/4)
|
// FIXME (https://github.com/rust-lang/rfcs/pull/4)
|
||||||
// remove Option<Self> arguments.
|
// remove Option<Self> arguments.
|
||||||
pub trait IDLInterface {
|
pub trait IDLInterface {
|
||||||
/// Returns the prototype ID.
|
/// Returns the prototype ID.
|
||||||
fn get_prototype_id(_: Option<Self>) -> PrototypeList::id;
|
fn get_prototype_id(_: Option<Self>) -> PrototypeList::ID;
|
||||||
/// Returns the prototype depth, i.e., the number of interfaces this
|
/// Returns the prototype depth, i.e., the number of interfaces this
|
||||||
/// interface inherits from.
|
/// interface inherits from.
|
||||||
fn get_prototype_depth(_: Option<Self>) -> uint;
|
fn get_prototype_depth(_: Option<Self>) -> uint;
|
||||||
|
|
|
@ -124,7 +124,7 @@ pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<DOMClass, ()> {
|
||||||
/// not a reflector for a DOM object of the given type (as defined by the
|
/// not a reflector for a DOM object of the given type (as defined by the
|
||||||
/// proto_id and proto_depth).
|
/// proto_id and proto_depth).
|
||||||
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
||||||
proto_id: PrototypeList::id,
|
proto_id: PrototypeList::ID,
|
||||||
proto_depth: uint) -> Result<JS<T>, ()> {
|
proto_depth: uint) -> Result<JS<T>, ()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let dom_class = get_dom_class(obj).or_else(|_| {
|
let dom_class = get_dom_class(obj).or_else(|_| {
|
||||||
|
@ -234,7 +234,7 @@ pub struct NativePropertyHooks {
|
||||||
pub struct DOMClass {
|
pub struct DOMClass {
|
||||||
/// A list of interfaces that this object implements, in order of decreasing
|
/// A list of interfaces that this object implements, in order of decreasing
|
||||||
/// derivedness.
|
/// derivedness.
|
||||||
pub interface_chain: [PrototypeList::id, ..MAX_PROTO_CHAIN_LENGTH],
|
pub interface_chain: [PrototypeList::ID, ..MAX_PROTO_CHAIN_LENGTH],
|
||||||
|
|
||||||
/// The NativePropertyHooks for the interface associated with this class.
|
/// The NativePropertyHooks for the interface associated with this class.
|
||||||
pub native_hooks: &'static NativePropertyHooks,
|
pub native_hooks: &'static NativePropertyHooks,
|
||||||
|
@ -421,7 +421,7 @@ pub unsafe extern fn ThrowingConstructor(cx: *mut JSContext, _argc: c_uint, _vp:
|
||||||
/// Construct and cache the ProtoOrIfaceArray for the given global.
|
/// Construct and cache the ProtoOrIfaceArray for the given global.
|
||||||
/// Fails if the argument is not a DOM global.
|
/// Fails if the argument is not a DOM global.
|
||||||
pub fn initialize_global(global: *mut JSObject) {
|
pub fn initialize_global(global: *mut JSObject) {
|
||||||
let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::Count as uint]);
|
let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::ID::Count as uint]);
|
||||||
unsafe {
|
unsafe {
|
||||||
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
||||||
let box_ = squirrel_away_unique(protoArray);
|
let box_ = squirrel_away_unique(protoArray);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue