aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2019-02-12 18:38:38 -0800
committerManish Goregaokar <manishsmail@gmail.com>2019-03-04 15:31:47 +0530
commitce635b715bc61d82e3d5bafb2964c960e7cc5f9c (patch)
tree2025d73316b015f3081a3072796dd385c09e0764 /components/script/dom/bindings/codegen/CodegenRust.py
parentcaa05948bf250944b259a5a95a8e6ef1db6a947b (diff)
downloadservo-ce635b715bc61d82e3d5bafb2964c960e7cc5f9c.tar.gz
servo-ce635b715bc61d82e3d5bafb2964c960e7cc5f9c.zip
Add support for default dict values being boolean, use in MediaStreamConstraints
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 1bd01651e76..fe88275bf20 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -747,7 +747,15 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
for memberType in type.unroll().flatMemberTypes
if memberType.isDictionary()
]
- if dictionaries:
+ if defaultValue and not isinstance(defaultValue, IDLNullValue):
+ tag = defaultValue.type.tag()
+ if tag is IDLType.Tags.bool:
+ default = "%s::Boolean(%s)" % (
+ union_native_type(type),
+ "true" if defaultValue.value else "false")
+ else:
+ raise("We don't currently support default values that aren't null or boolean")
+ elif dictionaries:
if defaultValue:
assert isinstance(defaultValue, IDLNullValue)
dictionary, = dictionaries