aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-05-29 22:10:21 -0400
committerGitHub <noreply@github.com>2020-05-29 22:10:21 -0400
commit1a6193703134512b8d09b54a85bf58b3df82a372 (patch)
tree3ff6f9c2b45da9226b937d464e63ffa4dfc63e72 /components/script/dom/bindings/codegen/CodegenRust.py
parent8e0a28178fe5d2e69be72b4525f12be82b85cf22 (diff)
parentc4f8167b6fa0d01c60deb9bb491a3565173db961 (diff)
downloadservo-1a6193703134512b8d09b54a85bf58b3df82a372.tar.gz
servo-1a6193703134512b8d09b54a85bf58b3df82a372.zip
Auto merge of #26718 - jdm:codegen-sequence, r=Manishearth
Improve precision of sequence types for WebIDL codegen. Unlike #26699, this doesn't attempt to improve any of the resulting types and only maintains the status quo. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index d4ded28f397..597e5611f74 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -677,7 +677,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if type.isSequence() or type.isRecord():
innerInfo = getJSToNativeConversionInfo(innerContainerType(type),
descriptorProvider,
- isMember=isMember,
+ isMember="Sequence",
isAutoRooted=isAutoRooted)
declType = wrapInNativeContainerType(type, innerInfo.declType)
config = getConversionConfigForType(type, isEnforceRange, isClamp, treatNullAs)
@@ -1075,7 +1075,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
assert not isEnforceRange and not isClamp
assert isMember != "Union"
- if isMember == "Dictionary" or isAutoRooted:
+ if isMember in ("Dictionary", "Sequence") or isAutoRooted:
templateBody = "${val}.get()"
if defaultValue is None:
@@ -1087,7 +1087,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
else:
raise TypeError("Can't handle non-null, non-undefined default value here")
- if isMember == "Dictionary":
+ if not isAutoRooted:
templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody
if default is not None:
default = "RootedTraceableBox::from_box(Heap::boxed(%s))" % default
@@ -1117,7 +1117,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
templateBody = "${val}.get().to_object()"
default = "ptr::null_mut()"
- if isMember in ("Dictionary", "Union"):
+ if isMember in ("Dictionary", "Union", "Sequence") and not isAutoRooted:
templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody
default = "RootedTraceableBox::new(Heap::default())"
declType = CGGeneric("RootedTraceableBox<Heap<*mut JSObject>>")