mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #5564 - Ms2ger:FromJSValConvertible, r=saneyuki
This commit is contained in:
commit
71e07013de
3 changed files with 23 additions and 60 deletions
|
@ -897,23 +897,12 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
if type.nullable():
|
||||
declType = CGWrapper(declType, pre="Option<", post=">")
|
||||
|
||||
template = ""
|
||||
if type.isFloat() and not type.isUnrestricted():
|
||||
template = (
|
||||
"match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n"
|
||||
" Ok(v) => v,\n"
|
||||
" Err(_) => {\n"
|
||||
" throw_type_error(cx, \"this argument is not a finite floating-point value\");\n"
|
||||
" %s\n"
|
||||
" }\n"
|
||||
"}" % exceptionCode)
|
||||
else:
|
||||
#XXXjdm support conversionBehavior here
|
||||
template = (
|
||||
"match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n"
|
||||
" Ok(v) => v,\n"
|
||||
" Err(_) => { %s }\n"
|
||||
"}" % exceptionCode)
|
||||
#XXXjdm support conversionBehavior here
|
||||
template = (
|
||||
"match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n"
|
||||
" Ok(v) => v,\n"
|
||||
" Err(_) => { %s }\n"
|
||||
"}" % exceptionCode)
|
||||
|
||||
if defaultValue is not None:
|
||||
if isinstance(defaultValue, IDLNullValue):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue