mirror of
https://github.com/servo/servo.git
synced 2025-06-14 11:24:33 +00:00
Move the assignment outside the if when dealing with optional arguments.
This commit is contained in:
parent
d14efebb5c
commit
aed95dfd94
1 changed files with 6 additions and 6 deletions
|
@ -824,6 +824,12 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
|
|||
string.Template(templateBody).substitute(replacements)
|
||||
)
|
||||
|
||||
if argcAndIndex is not None:
|
||||
condition = string.Template("${index} < ${argc}").substitute(argcAndIndex)
|
||||
conversion = CGIfElseWrapper(condition,
|
||||
conversion,
|
||||
CGGeneric("None"))
|
||||
|
||||
if declType is not None:
|
||||
newDecl = [CGGeneric("let mut "),
|
||||
CGGeneric(replacements["declName"]),
|
||||
|
@ -835,12 +841,6 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
|
|||
pre="%s = " % replacements["declName"],
|
||||
post=";")
|
||||
|
||||
if argcAndIndex is not None:
|
||||
condition = string.Template("${index} < ${argc}").substitute(argcAndIndex)
|
||||
conversion = CGIfElseWrapper(condition,
|
||||
conversion,
|
||||
CGGeneric("%s = None" % replacements["declName"]))
|
||||
|
||||
result.append(conversion)
|
||||
# Add an empty CGGeneric to get an extra newline after the argument
|
||||
# conversion.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue