Rename the PrototypeList enums to fix case build warnings.

This commit is contained in:
Ms2ger 2014-12-18 10:33:57 +01:00
parent d7b3900431
commit e2b75670bd
3 changed files with 19 additions and 20 deletions

View file

@ -104,8 +104,8 @@ class CastableObjectUnwrapper():
self.substitution = {
"type": descriptor.nativeType,
"depth": descriptor.interface.inheritanceDepth(),
"prototype": "PrototypeList::id::" + descriptor.name,
"protoID": "PrototypeList::id::" + descriptor.name + " as uint",
"prototype": "PrototypeList::ID::" + descriptor.name,
"protoID": "PrototypeList::ID::" + descriptor.name + " as uint",
"source": source,
"codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
}
@ -1418,12 +1418,12 @@ class CGNamespace(CGWrapper):
return CGNamespace(namespaces[0], inner, public=public)
def DOMClass(descriptor):
protoList = ['PrototypeList::id::' + proto for proto in descriptor.prototypeChain]
# Pad out the list to the right length with id::Count so we
protoList = ['PrototypeList::ID::' + proto for proto in descriptor.prototypeChain]
# Pad out the list to the right length with ID::Count so we
# 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
# padding.
protoList.extend(['PrototypeList::id::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
protoList.extend(['PrototypeList::ID::Count'] * (descriptor.config.maxProtoChainLength - len(protoList)))
prototypeChainString = ', '.join(protoList)
return """DOMClass {
interface_chain: [ %s ],
@ -1801,7 +1801,7 @@ def CreateBindingJSObject(descriptor, parent=None):
if descriptor.proxy:
assert not descriptor.isGlobal()
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 obj = with_compartment(aCx, proto, || {
NewProxyObject(aCx, handler,
@ -1887,8 +1887,8 @@ class CGIDLInterface(CGThing):
}
return string.Template("""
impl IDLInterface for ${type} {
fn get_prototype_id(_: Option<${type}>) -> PrototypeList::id {
PrototypeList::id::${type}
fn get_prototype_id(_: Option<${type}>) -> PrototypeList::ID {
PrototypeList::ID::${type}
}
fn get_prototype_depth(_: Option<${type}>) -> uint {
${depth}
@ -2023,7 +2023,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
Argument('*mut JSObject', 'aReceiver')]
CGAbstractMethod.__init__(self, descriptor, name,
'*mut JSObject', args, pub=pub)
self.id = idPrefix + "id::" + self.descriptor.name
self.id = idPrefix + "ID::" + self.descriptor.name
def definition_body(self):
return CGGeneric("""
@ -2682,7 +2682,7 @@ class CGMemberJITInfo(CGThing):
self.descriptor = descriptor
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()
failstr = "true" if infallible else "false"
return ("\n"
@ -4397,7 +4397,7 @@ class CGRegisterProxyHandlersMethod(CGAbstractMethod):
def definition_body(self):
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
], "\n")
@ -5135,8 +5135,8 @@ class GlobalGenRoots():
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
CGNonNamespacedEnum('id', protos, [0], deriving="PartialEq"),
CGNonNamespacedEnum('proxies', proxies, [0], deriving="PartialEq"),
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq"),
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq"),
])
@ -5150,7 +5150,7 @@ class GlobalGenRoots():
return CGImports(code, [], [
'dom::bindings::codegen',
'dom::bindings::codegen::PrototypeList::proxies',
'dom::bindings::codegen::PrototypeList::Proxies',
'js::jsapi::JSContext',
'js::jsapi::JSObject',
'libc',

View file

@ -6,6 +6,7 @@
//! Conversions of Rust values to and from `JSVal`.
use dom::bindings::codegen::PrototypeList;
use dom::bindings::js::{JS, JSRef, Root};
use dom::bindings::str::ByteString;
use dom::bindings::utils::{Reflectable, Reflector};
@ -29,15 +30,13 @@ use libc;
use std::default;
use std::slice;
use dom::bindings::codegen::PrototypeList;
/// 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(_: Option<Self>) -> PrototypeList::ID;
/// Returns the prototype depth, i.e., the number of interfaces this
/// interface inherits from.
fn get_prototype_depth(_: Option<Self>) -> uint;

View file

@ -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
/// proto_id and proto_depth).
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
proto_id: PrototypeList::id,
proto_id: PrototypeList::ID,
proto_depth: uint) -> Result<JS<T>, ()> {
unsafe {
let dom_class = get_dom_class(obj).or_else(|_| {
@ -234,7 +234,7 @@ pub struct NativePropertyHooks {
pub struct DOMClass {
/// A list of interfaces that this object implements, in order of decreasing
/// 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.
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.
/// Fails if the argument is not a DOM global.
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 {
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
let box_ = squirrel_away_unique(protoArray);