mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Share a little less code between the branches for conversion to any.
This commit is contained in:
parent
7d24cd7752
commit
5eaa19bdd4
1 changed files with 11 additions and 12 deletions
|
@ -1032,8 +1032,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
if type.isAny():
|
||||
assert not isEnforceRange and not isClamp
|
||||
|
||||
declType = ""
|
||||
default = ""
|
||||
if isMember == "Dictionary":
|
||||
# TODO: Need to properly root dictionaries
|
||||
# https://github.com/servo/servo/issues/6381
|
||||
|
@ -1047,17 +1045,18 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
default = "UndefinedValue()"
|
||||
else:
|
||||
raise TypeError("Can't handle non-null, non-undefined default value here")
|
||||
else:
|
||||
declType = CGGeneric("HandleValue")
|
||||
return handleOptional("${val}", declType, default)
|
||||
|
||||
if defaultValue is None:
|
||||
default = None
|
||||
elif isinstance(defaultValue, IDLNullValue):
|
||||
default = "HandleValue::null()"
|
||||
elif isinstance(defaultValue, IDLUndefinedValue):
|
||||
default = "HandleValue::undefined()"
|
||||
else:
|
||||
raise TypeError("Can't handle non-null, non-undefined default value here")
|
||||
declType = CGGeneric("HandleValue")
|
||||
|
||||
if defaultValue is None:
|
||||
default = None
|
||||
elif isinstance(defaultValue, IDLNullValue):
|
||||
default = "HandleValue::null()"
|
||||
elif isinstance(defaultValue, IDLUndefinedValue):
|
||||
default = "HandleValue::undefined()"
|
||||
else:
|
||||
raise TypeError("Can't handle non-null, non-undefined default value here")
|
||||
|
||||
return handleOptional("${val}", declType, default)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue