mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Support nullable typed arrays in codegen
This commit is contained in:
parent
e025bbb079
commit
6beb32e28e
3 changed files with 5 additions and 2 deletions
|
@ -882,7 +882,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
else:
|
||||
unwrapFailureCode = failureCode
|
||||
|
||||
typeName = type.name
|
||||
typeName = type.unroll().name # unroll because it may be nullable
|
||||
|
||||
if isMember == "Union":
|
||||
typeName = "Heap" + typeName
|
||||
|
||||
|
@ -902,7 +903,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
if isMember == "Union":
|
||||
templateBody = "RootedTraceableBox::new(%s)" % templateBody
|
||||
|
||||
declType = CGGeneric("typedarray::%s" % type.name)
|
||||
declType = CGGeneric("typedarray::%s" % typeName)
|
||||
if type.nullable():
|
||||
templateBody = "Some(%s)" % templateBody
|
||||
declType = CGWrapper(declType, pre="Option<", post=">")
|
||||
|
|
|
@ -492,6 +492,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn PassNullableInterface(&self, _: Option<&Blob>) {}
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn PassNullableObject(&self, _: *mut JSContext, _: *mut JSObject) {}
|
||||
fn PassNullableTypedArray(&self, _: CustomAutoRooterGuard<Option<typedarray::Int8Array>>) { }
|
||||
fn PassNullableUnion(&self, _: Option<HTMLElementOrLong>) {}
|
||||
fn PassNullableUnion2(&self, _: Option<EventOrString>) {}
|
||||
fn PassNullableUnion3(&self, _: Option<StringOrLongSequence>) {}
|
||||
|
|
|
@ -294,6 +294,7 @@ interface TestBinding {
|
|||
// void passNullableEnum(TestEnum? arg);
|
||||
void passNullableInterface(Blob? arg);
|
||||
void passNullableObject(object? arg);
|
||||
void passNullableTypedArray(Int8Array? arg);
|
||||
void passNullableUnion((HTMLElement or long)? arg);
|
||||
void passNullableUnion2((Event or DOMString)? data);
|
||||
void passNullableUnion3((DOMString or sequence<long>)? data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue