mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Fix string default values.
This commit is contained in:
parent
154427ce51
commit
5a1e6b772c
2 changed files with 6 additions and 13 deletions
|
@ -706,16 +706,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
default = "None"
|
||||
else:
|
||||
assert defaultValue.type.tag() == IDLType.Tags.domstring
|
||||
value = "str::from_utf8(&data).unwrap().to_owned()"
|
||||
default = '"%s".to_owned()' % defaultValue.value
|
||||
if type.nullable():
|
||||
value = "Some(%s)" % value
|
||||
|
||||
default = (
|
||||
"const data: [u8; %s] = [ %s ];\n"
|
||||
"%s" %
|
||||
(len(defaultValue.value) + 1,
|
||||
", ".join(["'" + char + "' as u8" for char in defaultValue.value] + ["0"]),
|
||||
value))
|
||||
default = "Some(%s)" % default
|
||||
|
||||
declType = "DOMString"
|
||||
if type.nullable():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue