зеркало из https://github.com/mozilla/gecko-dev.git
Bug 852219 part 1. Don't mark JS-implemented interfaces with descendant interfaces as final. r=khuey,mccr8
This commit is contained in:
Родитель
142568ca7e
Коммит
38246c449e
|
@ -5546,7 +5546,7 @@ ${className}::${className}(${args})${initializationList}
|
||||||
|
|
||||||
class ClassDestructor(ClassItem):
|
class ClassDestructor(ClassItem):
|
||||||
"""
|
"""
|
||||||
Used for adding a constructor to a CGClass.
|
Used for adding a destructor to a CGClass.
|
||||||
|
|
||||||
inline should be True if the destructor should be marked inline.
|
inline should be True if the destructor should be marked inline.
|
||||||
|
|
||||||
|
@ -5556,17 +5556,22 @@ class ClassDestructor(ClassItem):
|
||||||
visibility determines the visibility of the destructor (public,
|
visibility determines the visibility of the destructor (public,
|
||||||
protected, private), defaults to private.
|
protected, private), defaults to private.
|
||||||
|
|
||||||
body contains a string with the code for the destructor, defaults to None.
|
body contains a string with the code for the destructor, defaults to empty.
|
||||||
|
|
||||||
|
virtual determines whether the destructor is virtual, defaults to False.
|
||||||
"""
|
"""
|
||||||
def __init__(self, inline=False, bodyInHeader=False,
|
def __init__(self, inline=False, bodyInHeader=False,
|
||||||
visibility="private", body=None):
|
visibility="private", body='', virtual=False):
|
||||||
self.inline = inline or bodyInHeader
|
self.inline = inline or bodyInHeader
|
||||||
self.bodyInHeader = bodyInHeader
|
self.bodyInHeader = bodyInHeader
|
||||||
self.body = body
|
self.body = body
|
||||||
|
self.virtual = virtual
|
||||||
ClassItem.__init__(self, None, visibility)
|
ClassItem.__init__(self, None, visibility)
|
||||||
|
|
||||||
def getDecorators(self, declaring):
|
def getDecorators(self, declaring):
|
||||||
decorators = []
|
decorators = []
|
||||||
|
if self.virtual and declaring:
|
||||||
|
decorators.append('virtual')
|
||||||
if self.inline and declaring:
|
if self.inline and declaring:
|
||||||
decorators.append('inline')
|
decorators.append('inline')
|
||||||
if decorators:
|
if decorators:
|
||||||
|
@ -5574,7 +5579,6 @@ class ClassDestructor(ClassItem):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
assert self.body is not None
|
|
||||||
return self.body
|
return self.body
|
||||||
|
|
||||||
def declare(self, cgClass):
|
def declare(self, cgClass):
|
||||||
|
@ -8105,6 +8109,14 @@ class CGJSImplClass(CGBindingImplClass):
|
||||||
" NS_INTERFACE_MAP_ENTRY(nsISupports)\n"
|
" NS_INTERFACE_MAP_ENTRY(nsISupports)\n"
|
||||||
"NS_INTERFACE_MAP_END\n").substitute({ "ifaceName": self.descriptor.name })
|
"NS_INTERFACE_MAP_END\n").substitute({ "ifaceName": self.descriptor.name })
|
||||||
|
|
||||||
|
if descriptor.interface.hasChildInterfaces():
|
||||||
|
decorators = ""
|
||||||
|
# We need a public virtual destructor our subclasses can use
|
||||||
|
destructor = ClassDestructor(virtual=True, visibility="public")
|
||||||
|
else:
|
||||||
|
decorators = "MOZ_FINAL"
|
||||||
|
destructor = None
|
||||||
|
|
||||||
CGClass.__init__(self, descriptor.name,
|
CGClass.__init__(self, descriptor.name,
|
||||||
bases=[ClassBase("nsISupports"),
|
bases=[ClassBase("nsISupports"),
|
||||||
ClassBase("nsWrapperCache")],
|
ClassBase("nsWrapperCache")],
|
||||||
|
@ -8114,8 +8126,9 @@ class CGJSImplClass(CGBindingImplClass):
|
||||||
baseConstructors=["mImpl(aImpl)",
|
baseConstructors=["mImpl(aImpl)",
|
||||||
"mParent(aParent)"],
|
"mParent(aParent)"],
|
||||||
body="SetIsDOMBinding();")],
|
body="SetIsDOMBinding();")],
|
||||||
|
destructor=destructor,
|
||||||
methods=self.methodDecls,
|
methods=self.methodDecls,
|
||||||
decorators="MOZ_FINAL",
|
decorators=decorators,
|
||||||
extradeclarations=extradeclarations,
|
extradeclarations=extradeclarations,
|
||||||
extradefinitions=extradefinitions)
|
extradefinitions=extradefinitions)
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,7 @@ class IDLInterface(IDLObjectWithScope):
|
||||||
# self.interfacesImplementingSelf is the set of interfaces that directly
|
# self.interfacesImplementingSelf is the set of interfaces that directly
|
||||||
# have self as a consequential interface
|
# have self as a consequential interface
|
||||||
self.interfacesImplementingSelf = set()
|
self.interfacesImplementingSelf = set()
|
||||||
|
self._hasChildInterfaces = False
|
||||||
|
|
||||||
IDLObjectWithScope.__init__(self, location, parentScope, name)
|
IDLObjectWithScope.__init__(self, location, parentScope, name)
|
||||||
|
|
||||||
|
@ -567,6 +568,8 @@ class IDLInterface(IDLObjectWithScope):
|
||||||
if self.parent:
|
if self.parent:
|
||||||
self.parent.finish(scope)
|
self.parent.finish(scope)
|
||||||
|
|
||||||
|
self.parent._hasChildInterfaces = True
|
||||||
|
|
||||||
# Callbacks must not inherit from non-callbacks or inherit from
|
# Callbacks must not inherit from non-callbacks or inherit from
|
||||||
# anything that has consequential interfaces.
|
# anything that has consequential interfaces.
|
||||||
# XXXbz Can non-callbacks inherit from callbacks? Spec issue pending.
|
# XXXbz Can non-callbacks inherit from callbacks? Spec issue pending.
|
||||||
|
@ -977,6 +980,9 @@ class IDLInterface(IDLObjectWithScope):
|
||||||
def isJSImplemented(self):
|
def isJSImplemented(self):
|
||||||
return bool(self.getJSImplementation())
|
return bool(self.getJSImplementation())
|
||||||
|
|
||||||
|
def hasChildInterfaces(self):
|
||||||
|
return self._hasChildInterfaces
|
||||||
|
|
||||||
def _getDependentObjects(self):
|
def _getDependentObjects(self):
|
||||||
deps = set(self.members)
|
deps = set(self.members)
|
||||||
deps.union(self.implementedInterfaces)
|
deps.union(self.implementedInterfaces)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче