mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Common up some more code in the handling of default values for primitive types.
This commit is contained in:
parent
9fba4bcfba
commit
3a0b7fe621
1 changed files with 7 additions and 12 deletions
|
@ -1256,12 +1256,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||||
if defaultValue is not None:
|
if defaultValue is not None:
|
||||||
if isinstance(defaultValue, IDLNullValue):
|
if isinstance(defaultValue, IDLNullValue):
|
||||||
assert type.nullable()
|
assert type.nullable()
|
||||||
template = CGWrapper(CGIndenter(CGGeneric(template)),
|
defaultStr = "None"
|
||||||
pre="if ${haveValue} {\n",
|
|
||||||
post=("\n"
|
|
||||||
"} else {\n"
|
|
||||||
" ${declName} = None;\n"
|
|
||||||
"}")).define()
|
|
||||||
else:
|
else:
|
||||||
tag = defaultValue.type.tag()
|
tag = defaultValue.type.tag()
|
||||||
if tag in numericTags:
|
if tag in numericTags:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue