Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve precision of sequence types for WebIDL codegen. #26718

Merged
merged 1 commit into from May 30, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

dom: Improve precision of sequence types for WebIDL codegen.

  • Loading branch information
jdm committed May 29, 2020
commit c4f8167b6fa0d01c60deb9bb491a3565173db961
@@ -677,7 +677,7 @@ def wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
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 wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
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 wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
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 wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
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>>")
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.