diff options
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index da0d27ce764..b50efc90207 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -5686,7 +5686,11 @@ class CGInterfaceTrait(CGThing): yield name, arguments, rettype def fmt(arguments): - return "".join(", %s: %s" % argument for argument in arguments) + keywords = {"async"} + return "".join( + ", %s: %s" % (name if name not in keywords else "r#" + name, type_) + for name, type_ in arguments + ) def contains_unsafe_arg(arguments): if not arguments or len(arguments) == 0: @@ -6250,7 +6254,7 @@ class CGDictionary(CGThing): d = self.dictionary if d.parent: initParent = ("{\n" - " match try!(%s::%s::new(cx, val)) {\n" + " match r#try!(%s::%s::new(cx, val)) {\n" " ConversionResult::Success(v) => v,\n" " ConversionResult::Failure(error) => {\n" " throw_type_error(cx, &error);\n" @@ -6396,7 +6400,7 @@ 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" + " match r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n" " true => {\n" "%s\n" " },\n" @@ -7167,7 +7171,7 @@ class CallbackOperationBase(CallbackMethod): "methodName": self.methodName } getCallableFromProp = string.Template( - 'try!(self.parent.get_callable_property(cx, "${methodName}"))' + 'r#try!(self.parent.get_callable_property(cx, "${methodName}"))' ).substitute(replacements) if not self.singleOperation: return 'rooted!(in(cx) let callable =\n' + getCallableFromProp + ');\n' |