mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +00:00
Add support for undefined default values for 'any'.
This also updates TestBinding to take into account the automatic default for optional 'any' arguments and dictionary members.
This commit is contained in:
parent
4786c30bce
commit
ef0ccd3e15
2 changed files with 13 additions and 3 deletions
|
@ -518,7 +518,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
if not isinstance(defaultValue, IDLNullValue):
|
||||
raise TypeError("Can't handle non-null default value here")
|
||||
|
||||
assert type.nullable() or type.isAny() or type.isDictionary()
|
||||
assert type.nullable() or type.isDictionary()
|
||||
return nullValue
|
||||
|
||||
# A helper function for wrapping up the template body for
|
||||
|
@ -752,7 +752,17 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
assert not isEnforceRange and not isClamp
|
||||
|
||||
declType = CGGeneric("JSVal")
|
||||
return handleOptional("${val}", declType, handleDefaultNull("NullValue()"))
|
||||
|
||||
if defaultValue is None:
|
||||
default = None
|
||||
elif isinstance(defaultValue, IDLNullValue):
|
||||
default = "NullValue()"
|
||||
elif isinstance(defaultValue, IDLUndefinedValue):
|
||||
default = "UndefinedValue()"
|
||||
else:
|
||||
raise TypeError("Can't handle non-null, non-undefined default value here")
|
||||
|
||||
return handleOptional("${val}", declType, default)
|
||||
|
||||
if type.isObject():
|
||||
raise TypeError("Can't handle object arguments yet")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue