diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-04-07 13:35:28 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-04-07 14:16:34 +0200 |
commit | 6b79d57920a6f91e2fa4f9464e2c46b93ae3486d (patch) | |
tree | 533e5c1a1f31120adc112fde503b062557b99fa3 /components/script/dom/bindings/codegen | |
parent | e3683c85981c231621a624bdb2da62cb9cb66b45 (diff) | |
download | servo-6b79d57920a6f91e2fa4f9464e2c46b93ae3486d.tar.gz servo-6b79d57920a6f91e2fa4f9464e2c46b93ae3486d.zip |
When converting a non-finite float, throw the TypeError from the FromJSValConvertible implementation.
This removes some unnecessary custom code in the codegen and makes this
implementation follow the convention of having thrown an exception when
returning Err() from FromJSValConvertible.
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index b828ccb74bd..adebf601568 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -887,23 +887,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): |