Bug 1019705 - replace binaryNames accesses with binaryNameFor; r=bz

This commit is contained in:
Nathan Froyd 2014-06-03 12:20:16 -04:00
Родитель d346543b1b
Коммит 8463d09509
2 изменённых файлов: 18 добавлений и 20 удалений

Просмотреть файл

@ -1562,7 +1562,7 @@ class CGClassConstructor(CGAbstractStaticMethod):
ctorName=ctorName)
name = self._ctor.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
callGenerator = CGMethodCall(nativeName, True, self.descriptor,
self._ctor, isConstructor=True,
constructorName=ctorName)
@ -6947,7 +6947,7 @@ class CGSpecializedMethod(CGAbstractStaticMethod):
@staticmethod
def makeNativeName(descriptor, method):
name = method.identifier.name
return MakeNativeName(descriptor.binaryNames.get(name, name))
return MakeNativeName(descriptor.binaryNameFor(name))
class CGMethodPromiseWrapper(CGAbstractStaticMethod):
@ -7036,7 +7036,7 @@ class CGLegacyCallHook(CGAbstractBindingMethod):
def generate_code(self):
name = self._legacycaller.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
return CGMethodCall(nativeName, False, self.descriptor,
self._legacycaller)
@ -7287,7 +7287,7 @@ class CGSpecializedGetter(CGAbstractStaticMethod):
@staticmethod
def makeNativeName(descriptor, attr):
name = attr.identifier.name
nativeName = MakeNativeName(descriptor.binaryNames.get(name, name))
nativeName = MakeNativeName(descriptor.binaryNameFor(name))
# resultOutParam does not depend on whether resultAlreadyAddRefed is set
_, resultOutParam, _, _ = getRetvalDeclarationForType(attr.type,
descriptor,
@ -7390,7 +7390,7 @@ class CGSpecializedSetter(CGAbstractStaticMethod):
@staticmethod
def makeNativeName(descriptor, attr):
name = attr.identifier.name
return "Set" + MakeNativeName(descriptor.binaryNames.get(name, name))
return "Set" + MakeNativeName(descriptor.binaryNameFor(name))
class CGStaticSetter(CGAbstractStaticBindingMethod):
@ -9095,7 +9095,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
def __init__(self, descriptor, operation, checkFound=True, argumentMutableValue=None):
self.checkFound = checkFound
nativeName = MakeNativeName(descriptor.binaryNames.get(operation, operation))
nativeName = MakeNativeName(descriptor.binaryNameFor(operation))
operation = descriptor.operations[operation]
assert len(operation.signatures()) == 1
signature = operation.signatures()[0]
@ -12308,12 +12308,12 @@ def genConstructorBody(descriptor, initCall=""):
# We're always fallible
def callbackGetterName(attr, descriptor):
return "Get" + MakeNativeName(
descriptor.binaryNames.get(attr.identifier.name, attr.identifier.name))
descriptor.binaryNameFor(attr.identifier.name))
def callbackSetterName(attr, descriptor):
return "Set" + MakeNativeName(
descriptor.binaryNames.get(attr.identifier.name, attr.identifier.name))
descriptor.binaryNameFor(attr.identifier.name))
class CGJSImplGetter(CGJSImplMember):
@ -13052,7 +13052,7 @@ class CallbackOperationBase(CallbackMethod):
"""
def __init__(self, signature, jsName, nativeName, descriptor, singleOperation, rethrowContentException=False):
self.singleOperation = singleOperation
self.methodName = descriptor.binaryNames.get(jsName, jsName)
self.methodName = descriptor.binaryNameFor(jsName)
CallbackMethod.__init__(self, signature, nativeName, descriptor, singleOperation, rethrowContentException)
def getThisDecl(self):
@ -13107,7 +13107,7 @@ class CallbackOperation(CallbackOperationBase):
jsName = method.identifier.name
CallbackOperationBase.__init__(self, signature,
jsName,
MakeNativeName(descriptor.binaryNames.get(jsName, jsName)),
MakeNativeName(descriptor.binaryNameFor(jsName)),
descriptor, descriptor.interface.isSingleOperationInterface(),
rethrowContentException=descriptor.interface.isJSImplemented())
@ -13151,8 +13151,7 @@ class CallbackGetter(CallbackAccessor):
return${errorReturn};
}
""",
attrName=self.descriptorProvider.binaryNames.get(self.attrName,
self.attrName),
attrName=self.descriptorProvider.binaryNameFor(self.attrName),
errorReturn=self.getDefaultRetval())
@ -13177,8 +13176,7 @@ class CallbackSetter(CallbackAccessor):
return${errorReturn};
}
""",
attrName=self.descriptorProvider.binaryNames.get(self.attrName,
self.attrName),
attrName=self.descriptorProvider.binaryNameFor(self.attrName),
errorReturn=self.getDefaultRetval())
def getArgcDecl(self):

Просмотреть файл

@ -414,12 +414,9 @@ class Descriptor(DescriptorProvider):
for attribute in ['implicitJSContext', 'resultNotAddRefed']:
addExtendedAttribute(attribute, desc.get(attribute, {}))
self.binaryNames = desc.get('binaryNames', {})
if '__legacycaller' not in self.binaryNames:
self.binaryNames["__legacycaller"] = "LegacyCall"
if '__stringifier' not in self.binaryNames:
self.binaryNames["__stringifier"] = "Stringify"
self._binaryNames = desc.get('binaryNames', {})
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
self._binaryNames.setdefault('__stringifier', 'Stringify')
if not self.interface.isExternal():
self.permissions = dict()
@ -457,6 +454,9 @@ class Descriptor(DescriptorProvider):
config.maxProtoChainLength = max(config.maxProtoChainLength,
len(self.prototypeChain))
def binaryNameFor(self, name):
return self._binaryNames.get(name, name)
def hasInterfaceOrInterfacePrototypeObject(self):
# Forward-declared interfaces don't need either interface object or