auto merge of #1797 : Ms2ger/servo/IDL-debris, r=jdm

This commit is contained in:
bors-servo 2014-03-03 14:25:29 -05:00
commit 411892484b
3 changed files with 13 additions and 68 deletions

View file

@ -910,8 +910,7 @@ for (uint32_t i = 0; i < length; ++i) {
# This is an interface that we implement as a concrete class
# or an XPCOM interface.
# Allow null pointers for nullable types and old-binding classes
argIsPointer = type.nullable() or type.unroll().inner.isExternal()
argIsPointer = type.nullable()
# Sequences and callbacks have to hold a strong ref to the thing being
# passed down.
@ -1539,8 +1538,7 @@ for (uint32_t i = 0; i < length; ++i) {
"let mut %s = %s.unwrap();\n" % (result, result))
else:
wrappingCode = ""
if (not descriptor.interface.isExternal() and
not descriptor.interface.isCallback()):
if not descriptor.interface.isCallback():
wrap = "GetReflector(cx, (%s).reflector(), ${jsvalPtr} as *mut JSVal)" % result
# Non-prefable bindings can only fail to wrap as a new-binding object
# if they already threw an exception. Same thing for
@ -2398,9 +2396,6 @@ def UnionTypes(descriptors):
declarations = set()
unionStructs = dict()
for d in descriptors:
if d.interface.isExternal():
continue
for t in getTypes(d):
t = t.unroll()
if t.isUnion():
@ -2430,9 +2425,6 @@ def UnionConversions(descriptors):
# need to unwrap them.
unionConversions = dict()
for d in descriptors:
if d.interface.isExternal():
continue
def addUnionTypes(type):
if type.isUnion():
type = type.unroll()
@ -3592,8 +3584,7 @@ def getUnionAccessorSignatureType(type, descriptorProvider):
descriptor = descriptorProvider.getDescriptor(
type.unroll().inner.identifier.name)
typeName = CGGeneric(descriptor.nativeType)
# Allow null pointers for nullable types and old-binding classes
if type.nullable() or type.unroll().inner.isExternal():
if type.nullable():
typeName = CGWrapper(typeName, pre="Option<", post=">")
else:
typeName = CGWrapper(typeName, pre="&'a ")
@ -4919,8 +4910,7 @@ class CGDescriptor(CGThing):
if descriptor.interface.hasInterfaceObject():
cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
if (not descriptor.interface.isExternal() and
descriptor.interface.getExtendedAttribute("PrefControlled") is not None):
if (descriptor.interface.getExtendedAttribute("PrefControlled") is not None):
#cgThings.append(CGPrefEnabled(descriptor))
pass
@ -5253,7 +5243,6 @@ class CGRegisterProtos(CGAbstractMethod):
def _registerProtos(self):
lines = [" assert!(codegen::%sBinding::DefineDOMInterface(js_info));" % (desc.name)
for desc in self.config.getDescriptors(hasInterfaceObject=True,
isExternal=False,
register=True)]
return '\n'.join(lines) + '\n'
def definition_body(self):
@ -5587,7 +5576,7 @@ class CGNativeMember(ClassMethod):
if type.isGeckoInterface() and not type.isCallbackInterface():
iface = type.unroll().inner
argIsPointer = type.nullable() or iface.isExternal()
argIsPointer = type.nullable()
forceOwningType = iface.isCallback() or isMember
if argIsPointer:
if (optional or isMember) and forceOwningType:

View file

@ -57,17 +57,13 @@ class Configuration:
if key == 'webIDLFile':
getter = lambda x: x.interface.filename()
elif key == 'hasInterfaceObject':
getter = lambda x: (not x.interface.isExternal() and
x.interface.hasInterfaceObject())
getter = lambda x: x.interface.hasInterfaceObject()
elif key == 'hasInterfacePrototypeObject':
getter = lambda x: (not x.interface.isExternal() and
x.interface.hasInterfacePrototypeObject())
getter = lambda x: x.interface.hasInterfacePrototypeObject()
elif key == 'hasInterfaceOrInterfacePrototypeObject':
getter = lambda x: x.hasInterfaceOrInterfacePrototypeObject()
elif key == 'isCallback':
getter = lambda x: x.interface.isCallback()
elif key == 'isExternal':
getter = lambda x: x.interface.isExternal()
elif key == 'isJSImplemented':
getter = lambda x: x.interface.isJSImplemented()
else:
@ -132,7 +128,7 @@ class Descriptor(DescriptorProvider):
# Read the desc, and fill in the relevant defaults.
ifaceName = self.interface.identifier.name
if self.interface.isExternal() or self.interface.isCallback():
if self.interface.isCallback():
nativeTypeDefault = "nsIDOM" + ifaceName
else:
nativeTypeDefault = 'JS<%s>' % ifaceName
@ -142,9 +138,9 @@ class Descriptor(DescriptorProvider):
self.needsAbstract = desc.get('needsAbstract', [])
self.createGlobal = desc.get('createGlobal', False)
if self.interface.isCallback() or self.interface.isExternal():
if self.interface.isCallback():
if 'castable' in desc:
raise TypeError("%s is external or callback but has a castable "
raise TypeError("%s is callback but has a castable "
"setting" % self.interface.identifier.name)
self.castable = False
else:
@ -154,7 +150,7 @@ class Descriptor(DescriptorProvider):
# If we're concrete, we need to crawl our ancestor interfaces and mark
# them as having a concrete descendant.
self.concrete = desc.get('concrete', not self.interface.isExternal())
self.concrete = desc.get('concrete', True)
if self.concrete:
self.proxy = False
operations = {
@ -248,13 +244,6 @@ class Descriptor(DescriptorProvider):
len(self.prototypeChain))
def hasInterfaceOrInterfacePrototypeObject(self):
# Forward-declared interfaces don't need either interface object or
# interface prototype object as they're going to use QI (on main thread)
# or be passed as a JSObject (on worker threads).
if self.interface.isExternal():
return False
return self.interface.hasInterfaceObject() or self.interface.hasInterfacePrototypeObject()
def getExtendedAttributes(self, member, getter=False, setter=False):

View file

@ -450,41 +450,8 @@ class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
class IDLExternalInterface(IDLObjectWithIdentifier):
def __init__(self, location, parentScope, identifier):
assert isinstance(identifier, IDLUnresolvedIdentifier)
assert isinstance(parentScope, IDLScope)
self.parent = None
IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
IDLObjectWithIdentifier.resolve(self, parentScope)
def finish(self, scope):
pass
def validate(self):
pass
def isExternal(self):
return True
def isInterface(self):
return True
def isConsequential(self):
return False
def addExtendedAttributes(self, attrs):
assert len(attrs) == 0
def resolve(self, parentScope):
pass
def getJSImplementation(self):
return None
def isJSImplemented(self):
return False
def _getDependentObjects(self):
return set()
raise WebIDLError("Servo does not support external interfaces.",
[self.location])
class IDLInterface(IDLObjectWithScope):
def __init__(self, location, parentScope, name, parent, members,