mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Use RootedTraceableBox for unions.
This commit is contained in:
parent
0cc6d3e997
commit
d5f8b35a5f
2 changed files with 7 additions and 1 deletions
|
@ -722,6 +722,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
if type.nullable():
|
||||
declType = CGWrapper(declType, pre="Option<", post=" >")
|
||||
|
||||
if isMember != "Dictionary" and type_needs_tracing(type):
|
||||
declType = CGTemplatedType("RootedTraceableBox", declType)
|
||||
|
||||
templateBody = ("match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n"
|
||||
" Ok(ConversionResult::Success(value)) => value,\n"
|
||||
" Ok(ConversionResult::Failure(error)) => {\n"
|
||||
|
@ -6190,6 +6193,9 @@ def type_needs_tracing(t):
|
|||
if t.isSequence():
|
||||
return type_needs_tracing(t.inner)
|
||||
|
||||
if t.isUnion():
|
||||
return any(type_needs_tracing(member) for member in t.flatMemberTypes)
|
||||
|
||||
return False
|
||||
|
||||
if t.isDictionary():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue