mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove the proto_{id,depth} arguments from unwrap_jsmanaged.
Instead, we infer them from the type we're unwrapping into. This will prevent any mismatches between the type we return and the type we check for.
This commit is contained in:
parent
e1dae2f59b
commit
b8c2573f4d
3 changed files with 8 additions and 17 deletions
|
@ -102,17 +102,13 @@ class CastableObjectUnwrapper():
|
|||
"""
|
||||
def __init__(self, descriptor, source, codeOnFailure):
|
||||
self.substitution = {
|
||||
"type": descriptor.nativeType,
|
||||
"depth": descriptor.interface.inheritanceDepth(),
|
||||
"prototype": "PrototypeList::ID::" + descriptor.name,
|
||||
"protoID": "PrototypeList::ID::" + descriptor.name + " as uint",
|
||||
"source": source,
|
||||
"codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
|
||||
}
|
||||
|
||||
def __str__(self):
|
||||
return string.Template(
|
||||
"""match unwrap_jsmanaged(${source}, ${prototype}, ${depth}) {
|
||||
"""match unwrap_jsmanaged(${source}) {
|
||||
Ok(val) => val,
|
||||
Err(()) => {
|
||||
${codeOnFailure}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue