Remove FailureFatalCastableObjectUnwrapper.

The inheritance pattern used here was not particularly enlightening, and only
one caller uses FailureFatalCastableObjectUnwrapper.
This commit is contained in:
Ms2ger 2014-08-04 14:50:47 +02:00
parent db3078fde4
commit 7f707020be

View file

@ -119,20 +119,6 @@ ${codeOnFailure}
} }
}""").substitute(self.substitution) }""").substitute(self.substitution)
#"""{
# nsresult rv = UnwrapObject<${protoID}, ${type}>(cx, ${source}, ${target});
# if (NS_FAILED(rv)) {
#${codeOnFailure}
# }
#}""").substitute(self.substitution)
class FailureFatalCastableObjectUnwrapper(CastableObjectUnwrapper):
"""
As CastableObjectUnwrapper, but defaulting to throwing if unwrapping fails
"""
def __init__(self, descriptor, source):
CastableObjectUnwrapper.__init__(self, descriptor, source,
"return 0; //XXXjdm return Throw(cx, rv);")
class CGThing(): class CGThing():
""" """
@ -599,15 +585,15 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
raise TypeError("Consequential interface %s being used as an " raise TypeError("Consequential interface %s being used as an "
"argument" % descriptor.interface.identifier.name) "argument" % descriptor.interface.identifier.name)
if failureCode is not None: if failureCode is None:
templateBody = str(CastableObjectUnwrapper( unwrapFailureCode = "return 0; //XXXjdm return Throw(cx, rv);"
descriptor,
"(${val}).to_object()",
failureCode))
else: else:
templateBody = str(FailureFatalCastableObjectUnwrapper( unwrapFailureCode = failureCode
descriptor,
"(${val}).to_object()")) templateBody = str(CastableObjectUnwrapper(
descriptor,
"(${val}).to_object()",
unwrapFailureCode))
declType = CGGeneric(descriptorType) declType = CGGeneric(descriptorType)
if type.nullable(): if type.nullable():