aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-02-20 05:54:53 -0700
committerbors-servo <metajack+bors@gmail.com>2015-02-20 05:54:53 -0700
commit45a0e0e65c0d104c3e29f6521b11b4285cde58d2 (patch)
tree3cd6aaf8d127be67c2f90fac688e97d286ed8ac2 /components/script/dom/bindings/codegen
parent0a4c8c0e4c0e8c94a82363b10971c99fc0d9abbc (diff)
parent81eab460b17afbb93f1a406df0e2d87f9c40c764 (diff)
downloadservo-45a0e0e65c0d104c3e29f6521b11b4285cde58d2.tar.gz
servo-45a0e0e65c0d104c3e29f6521b11b4285cde58d2.zip
auto merge of #4978 : Ms2ger/servo/try-dicts, r=Manishearth
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index af6af8118cc..18271a3e4ac 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -4365,11 +4365,9 @@ class CGDictionary(CGThing):
def impl(self):
d = self.dictionary
if d.parent:
- initParent = ("parent: match %s::%s::new(cx, val) {\n"
- " Ok(parent) => parent,\n"
- " Err(_) => return Err(()),\n"
- "},\n") % (self.makeModuleName(d.parent),
- self.makeClassName(d.parent))
+ initParent = "parent: try!(%s::%s::new(cx, val)),\n" % (
+ self.makeModuleName(d.parent),
+ self.makeClassName(d.parent))
else:
initParent = ""
@@ -4441,12 +4439,11 @@ class CGDictionary(CGThing):
conversion = "Some(%s)" % conversion
conversion = (
- "match get_dictionary_property(cx, object, \"%s\") {\n"
- " Err(()) => return Err(()),\n"
- " Ok(Some(value)) => {\n"
+ "match try!(get_dictionary_property(cx, object, \"%s\")) {\n"
+ " Some(value) => {\n"
"%s\n"
" },\n"
- " Ok(None) => {\n"
+ " None => {\n"
"%s\n"
" },\n"
"}") % (member.identifier.name, indent(conversion), indent(default))