Introduce Descriptor.prototypeDepth

This commit is contained in:
Anthony Ramine 2016-01-06 00:48:22 +01:00
parent 7693aecf15
commit d52948dfd5
2 changed files with 3 additions and 2 deletions

View file

@ -2283,8 +2283,8 @@ class CGIDLInterface(CGThing):
name = self.descriptor.name name = self.descriptor.name
if (interface.getUserData("hasConcreteDescendant", False) or if (interface.getUserData("hasConcreteDescendant", False) or
interface.getUserData("hasProxyDescendant", False)): interface.getUserData("hasProxyDescendant", False)):
depth = len(self.descriptor.prototypeChain) depth = self.descriptor.prototypeDepth
check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth - 1, name) check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth, name)
elif self.descriptor.proxy: elif self.descriptor.proxy:
check = "class as *const _ == &Class as *const _" check = "class as *const _ == &Class as *const _"
else: else:

View file

@ -296,6 +296,7 @@ class Descriptor(DescriptorProvider):
while parent: while parent:
self.prototypeChain.insert(0, parent.identifier.name) self.prototypeChain.insert(0, parent.identifier.name)
parent = parent.parent parent = parent.parent
self.prototypeDepth = len(self.prototypeChain) - 1
config.maxProtoChainLength = max(config.maxProtoChainLength, config.maxProtoChainLength = max(config.maxProtoChainLength,
len(self.prototypeChain)) len(self.prototypeChain))