aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-01-31 07:41:43 -0800
committerGitHub <noreply@github.com>2017-01-31 07:41:43 -0800
commitec9da4d2763bad2df96757d3f8f2666b9d0507f2 (patch)
tree780490439f477d9469a01ccb70bba7d42ea1906f /components/script/dom/bindings/codegen
parentedc576597860be4559bc9dc93da38f215c4a80a0 (diff)
parentf376f9c2d72e6b937f7fe74d5ea1615a31eb60f5 (diff)
downloadservo-ec9da4d2763bad2df96757d3f8f2666b9d0507f2.tar.gz
servo-ec9da4d2763bad2df96757d3f8f2666b9d0507f2.zip
Auto merge of #15315 - servo:reformat-dict, r=jdm
Improve the readability of dictionaries' new() method. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15315) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 093f402fa47..b2fdbbfaf51 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -5894,14 +5894,16 @@ class CGDictionary(CGThing):
def impl(self):
d = self.dictionary
if d.parent:
- initParent = ("parent: match try!(%s::%s::new(cx, val)) {\n"
- " ConversionResult::Success(v) => v,\n"
- " ConversionResult::Failure(error) => {\n"
- " throw_type_error(cx, &error);\n"
- " return Err(());\n"
- " }\n"
- " },\n" % (self.makeModuleName(d.parent),
- self.makeClassName(d.parent)))
+ initParent = ("parent: {\n"
+ " match try!(%s::%s::new(cx, val)) {\n"
+ " ConversionResult::Success(v) => v,\n"
+ " ConversionResult::Failure(error) => {\n"
+ " throw_type_error(cx, &error);\n"
+ " return Err(());\n"
+ " }\n"
+ " }\n"
+ "},\n" % (self.makeModuleName(d.parent),
+ self.makeClassName(d.parent)))
else:
initParent = ""
@@ -5999,7 +6001,7 @@ class CGDictionary(CGThing):
def getMemberConversion(self, memberInfo, memberType):
def indent(s):
- return CGIndenter(CGGeneric(s), 8).define()
+ return CGIndenter(CGGeneric(s), 12).define()
member, info = memberInfo
templateBody = info.template
@@ -6020,15 +6022,16 @@ class CGDictionary(CGThing):
conversion = (
"{\n"
- "rooted!(in(cx) let mut rval = UndefinedValue());\n"
- "match try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
- " true => {\n"
+ " rooted!(in(cx) let mut rval = UndefinedValue());\n"
+ " match try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
+ " true => {\n"
"%s\n"
- " },\n"
- " false => {\n"
+ " },\n"
+ " false => {\n"
"%s\n"
- " },\n"
- "}\n}") % (member.identifier.name, indent(conversion), indent(default))
+ " },\n"
+ " }\n"
+ "}") % (member.identifier.name, indent(conversion), indent(default))
return CGGeneric(conversion)