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. codeOnFailure is the code to run if unwrapping fails.
""" """
def __init__(self, descriptor, source, codeOnFailure): def __init__(self, descriptor, source, codeOnFailure):
self.substitution = { "type" : descriptor.nativeType, self.substitution = {
"type": descriptor.nativeType,
"depth": descriptor.interface.inheritanceDepth(), "depth": descriptor.interface.inheritanceDepth(),
"prototype": "PrototypeList::id::" + descriptor.name, "prototype": "PrototypeList::id::" + descriptor.name,
"protoID" : "PrototypeList::id::" + descriptor.name + " as uint", "protoID": "PrototypeList::id::" + descriptor.name + " as uint",
"source" : source, "source": source,
"codeOnFailure" : CGIndenter(CGGeneric(codeOnFailure), 4).define()} "codeOnFailure": CGIndenter(CGGeneric(codeOnFailure), 4).define(),
}
def __str__(self): def __str__(self):
return string.Template( return string.Template(
"""match unwrap_jsmanaged(${source}, ${prototype}, ${depth}) { """match unwrap_jsmanaged(${source}, ${prototype}, ${depth}) {
Ok(val) => val, Ok(val) => val,
Err(()) => { Err(()) => {
${codeOnFailure} ${codeOnFailure}
} }
}""").substitute(self.substitution) }""").substitute(self.substitution)