diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-05-03 14:58:49 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-05-05 11:36:52 +0200 |
commit | d14efebb5c2ad4dcfa178cfc140bc54f81d93b2d (patch) | |
tree | 2dcd0447a8702c41b6ee70b9b50ba38a77cbdb55 | |
parent | cb2723c4ed4c6539b33029d9ecc3460914fb26a8 (diff) | |
download | servo-d14efebb5c2ad4dcfa178cfc140bc54f81d93b2d.tar.gz servo-d14efebb5c2ad4dcfa178cfc140bc54f81d93b2d.zip |
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.
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 6 |
1 files changed, 3 insertions, 3 deletions
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 |