mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Remove FailureFatalCastableObjectUnwrapper.
The inheritance pattern used here was not particularly enlightening, and only one caller uses FailureFatalCastableObjectUnwrapper.
This commit is contained in:
parent
db3078fde4
commit
7f707020be
1 changed files with 8 additions and 22 deletions
|
@ -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():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue