Support USVString as default value of a union argument

This commit is contained in:
Kagami Sascha Rosylight 2019-10-17 12:06:41 +09:00
parent c5d6bb604d
commit e905a4606a
3 changed files with 10 additions and 8 deletions

View file

@ -732,6 +732,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
default = "%s::Boolean(%s)" % (
union_native_type(type),
"true" if defaultValue.value else "false")
elif tag is IDLType.Tags.usvstring:
default = '%s::USVString(USVString("%s".to_owned()))' % (
union_native_type(type),
defaultValue.value)
else:
raise("We don't currently support default values that aren't null, boolean or default dictionary")
elif dictionaries: