aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 327fa119c9f..7bb5663b026 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -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.