auto merge of #2611 : Ms2ger/servo/webidl-parser-sync, r=jdm

This commit is contained in:
bors-servo 2014-06-09 22:19:44 -04:00
commit 0ff6a45709
12 changed files with 1239 additions and 286 deletions

View file

@ -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")