aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-11-21 21:39:44 -0500
committerGitHub <noreply@github.com>2019-11-21 21:39:44 -0500
commit49f47ea09f33a0ba754ce11efe753ea361e8f404 (patch)
treedc3478a79174ccdb72fc6745578ef06b60cb64c2 /components/script/dom/bindings/codegen
parentfdd5dadc3a300d4e1083b2902b853747d61179b9 (diff)
parent22278a88953c4d7225de60e3c3c2a297273fe2d9 (diff)
downloadservo-49f47ea09f33a0ba754ce11efe753ea361e8f404.tar.gz
servo-49f47ea09f33a0ba754ce11efe753ea361e8f404.zip
Auto merge of #24816 - saschanaz:promiserejection, r=jdm
Require PromiseRejectionEventInit dictionary <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #22670 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 7610b8442b4..fe3398417b2 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -6425,7 +6425,8 @@ class CGDictionary(CGThing):
mustRoot = ""
if self.membersNeedTracing():
mustRoot = "#[unrooted_must_root_lint::must_root]\n"
- derive += ["Default"]
+ if not self.hasRequiredFields(self.dictionary):
+ derive += ["Default"]
return (string.Template(
"#[derive(${derive})]\n"
@@ -6485,16 +6486,14 @@ class CGDictionary(CGThing):
selfName = self.makeClassName(d)
if self.membersNeedTracing():
actualType = "RootedTraceableBox<%s>" % selfName
- preInitial = "let mut dictionary = RootedTraceableBox::new(%s::default());\n" % selfName
- initParent = initParent = ("dictionary.parent = %s;\n" % initParent) if initParent else ""
- memberInits = CGList([memberInit(m, False) for m in self.memberInfo])
- postInitial = ""
+ preInitial = "let dictionary = RootedTraceableBox::new(%s {\n" % selfName
+ postInitial = "});\n"
else:
actualType = selfName
preInitial = "let dictionary = %s {\n" % selfName
postInitial = "};\n"
- initParent = ("parent: %s,\n" % initParent) if initParent else ""
- memberInits = CGList([memberInit(m, True) for m in self.memberInfo])
+ initParent = ("parent: %s,\n" % initParent) if initParent else ""
+ memberInits = CGList([memberInit(m, True) for m in self.memberInfo])
return string.Template(
"impl ${selfName} {\n"
@@ -6540,8 +6539,8 @@ class CGDictionary(CGThing):
"initParent": CGIndenter(CGGeneric(initParent), indentLevel=16).define(),
"initMembers": CGIndenter(memberInits, indentLevel=16).define(),
"insertMembers": CGIndenter(memberInserts, indentLevel=8).define(),
- "preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=16).define(),
- "postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=16).define(),
+ "preInitial": CGIndenter(CGGeneric(preInitial), indentLevel=8).define(),
+ "postInitial": CGIndenter(CGGeneric(postInitial), indentLevel=8).define(),
})
def membersNeedTracing(self):