Move the assignment of 'None' in the no-argument-passed case into an else branch.

This is the only case where we assign into an argument local twice, so removing
it will allow us to make that binding immutable.
This commit is contained in:
Ms2ger 2014-05-03 14:58:49 +02:00
parent cb2723c4ed
commit d14efebb5c

View file

@ -829,8 +829,6 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
CGGeneric(replacements["declName"]),
CGGeneric(": "),
declType]
if dealWithOptional:
newDecl.append(CGGeneric(" = None"))
newDecl.append(CGGeneric(";"))
result.append(CGList(newDecl))
conversion = CGWrapper(conversion,
@ -839,7 +837,9 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
if argcAndIndex is not None:
condition = string.Template("${index} < ${argc}").substitute(argcAndIndex)
conversion = CGIfWrapper(conversion, condition)
conversion = CGIfElseWrapper(condition,
conversion,
CGGeneric("%s = None" % replacements["declName"]))
result.append(conversion)
# Add an empty CGGeneric to get an extra newline after the argument