aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-01-15 14:17:31 +0100
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-01-15 14:30:38 +0100
commit950821989f57933a1b83623e1a2aea3dccd6c52c (patch)
tree153eb2630aa292d11014b9135dda1bc728935246 /components/script/dom/bindings/codegen
parent8859c617a8ce0e0c16ea15cdef0397907f433fab (diff)
downloadservo-950821989f57933a1b83623e1a2aea3dccd6c52c.tar.gz
servo-950821989f57933a1b83623e1a2aea3dccd6c52c.zip
webidl: Refactor isSequence in getJSToNativeConversionInfo
That way it does not depend on the return value for the same type. This hopefully makes the code more clear, and avoids errors if something changes in the future (for example, we could want to pass slices as sequence arguments).
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 643c396febc..84d80124df9 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -700,10 +700,13 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
raise TypeError("Can't handle array arguments yet")
if type.isSequence():
- # Use the same type that for return values
- declType = getRetvalDeclarationForType(type, descriptorProvider)
+ innerInfo = getJSToNativeConversionInfo(type.unroll(), descriptorProvider)
+ declType = CGWrapper(innerInfo.declType, pre="Vec<", post=">")
config = getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs)
+ if type.nullable():
+ declType = CGWrapper(declType, pre="Option<", post=" >")
+
templateBody = ("match FromJSValConvertible::from_jsval(cx, ${val}, %s) {\n"
" Ok(value) => value,\n"
" Err(()) => { %s },\n"