From d14efebb5c2ad4dcfa178cfc140bc54f81d93b2d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 3 May 2014 14:58:49 +0200 Subject: 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. --- src/components/script/dom/bindings/codegen/CodegenRust.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py') diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 7225b8f0ffa..327fa119c9f 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -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 -- cgit v1.2.3