Fix the double indentation in CastableObjectUnwrapper.

The current code indents the first line of codeOnFailure four spaces too far.
This commit is contained in:
Ms2ger 2014-08-04 14:39:04 +02:00
parent e7c2329649
commit db3078fde4

View file

@ -101,19 +101,21 @@ class CastableObjectUnwrapper():
codeOnFailure is the code to run if unwrapping fails.
"""
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()}
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}) {
Ok(val) => val,
Err(()) => {
${codeOnFailure}
${codeOnFailure}
}
}""").substitute(self.substitution)