mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 1584009 part 1. Loosen up the check for dictionary-containing-union-containing-dictionary. r=peterv
Since unions can now end up a in binding header, it's only a problem when the two dictionaries are in one header and the union is in a different one. If all three are in the same header, for example, there is no issue. Differential Revision: https://phabricator.services.mozilla.com/D47195 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6b3bd4ae9a
commit
a1e9012980
@ -13492,20 +13492,25 @@ class CGDictionary(CGThing):
|
||||
sourceDescription=self.getMemberSourceDescription(member)))
|
||||
for member in dictionary.members]
|
||||
|
||||
# If we have a union member containing something in the same
|
||||
# file as us, bail: the C++ includes won't work out.
|
||||
# If we have a union member which is going to be declared in a different
|
||||
# header but contains something that will be declared in the same header
|
||||
# as us, bail: the C++ includes won't work out.
|
||||
for member in dictionary.members:
|
||||
type = member.type.unroll()
|
||||
if type.isUnion():
|
||||
if (type.isUnion() and
|
||||
CGHeaders.getUnionDeclarationFilename(descriptorProvider.getConfig(),
|
||||
type) !=
|
||||
CGHeaders.getDeclarationFilename(dictionary)):
|
||||
for t in type.flatMemberTypes:
|
||||
if (t.isDictionary() and
|
||||
CGHeaders.getDeclarationFilename(t.inner) ==
|
||||
CGHeaders.getDeclarationFilename(dictionary)):
|
||||
raise TypeError(
|
||||
"Dictionary contains a union that contains a "
|
||||
"dictionary in the same WebIDL file. This won't "
|
||||
"compile. Move the inner dictionary to a "
|
||||
"different file.\n%s\n%s" %
|
||||
"Dictionary contains a union that will live in a different "
|
||||
"header that contains a dictionary from the same header as "
|
||||
"the original dictionary. This won't compile. Move the "
|
||||
"inner dictionary to a different Web IDL file to move it "
|
||||
"to a different header.\n%s\n%s" %
|
||||
(t.location, t.inner.location))
|
||||
self.structs = self.getStructs()
|
||||
|
||||
|
@ -13,6 +13,9 @@ class DescriptorProvider:
|
||||
"""
|
||||
A way of getting descriptors for interface names. Subclasses must
|
||||
have a getDescriptor method callable with the interface name only.
|
||||
|
||||
Subclasses must also have a getConfig() method that returns a
|
||||
Configuration.
|
||||
"""
|
||||
def __init__(self):
|
||||
pass
|
||||
@ -270,6 +273,9 @@ class Configuration(DescriptorProvider):
|
||||
|
||||
raise NoSuchDescriptorError("For " + interfaceName + " found no matches")
|
||||
|
||||
def getConfig(self):
|
||||
return self
|
||||
|
||||
|
||||
class NoSuchDescriptorError(TypeError):
|
||||
def __init__(self, str):
|
||||
@ -776,6 +782,9 @@ class Descriptor(DescriptorProvider):
|
||||
"""
|
||||
return self.config.getDescriptor(interfaceName)
|
||||
|
||||
def getConfig(self):
|
||||
return self.config
|
||||
|
||||
|
||||
# Some utility methods
|
||||
def getTypesFromDescriptor(descriptor):
|
||||
|
Loading…
x
Reference in New Issue
Block a user