mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Use handleOptional for the union conversion.
Note that unions didn't handle optional arguments correctly before.
This commit is contained in:
parent
1e2be02eb8
commit
b73a87e955
3 changed files with 5 additions and 5 deletions
|
@ -597,7 +597,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
templateBody = handleDefaultNull(templateBody.define(),
|
||||
"None")
|
||||
|
||||
return (templateBody, declType, isOptional, "None" if isOptional else None)
|
||||
return handleOptional(templateBody, declType, isOptional)
|
||||
|
||||
if type.isGeckoInterface():
|
||||
assert not isEnforceRange and not isClamp
|
||||
|
|
|
@ -129,7 +129,7 @@ impl TestBinding {
|
|||
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
|
||||
// pub fn PassOptionalEnum(&self, _: Option<TestEnum>) {}
|
||||
pub fn PassOptionalInterface(&self, _: Option<JS<Blob>>) {}
|
||||
// pub fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
|
||||
pub fn PassOptionalUnion(&self, _: Option<HTMLElementOrLong>) {}
|
||||
pub fn PassOptionalAny(&self, _: *JSContext, _: Option<JSVal>) {}
|
||||
|
||||
pub fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
|
||||
|
@ -146,7 +146,7 @@ impl TestBinding {
|
|||
pub fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
|
||||
// pub fn PassOptionalNullableEnum(&self, _: Option<Option<TestEnum>>) {}
|
||||
// pub fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>) {}
|
||||
// pub fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
|
||||
pub fn PassOptionalNullableUnion(&self, _: Option<Option<HTMLElementOrLong>>) {}
|
||||
|
||||
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
||||
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
|
||||
|
|
|
@ -134,7 +134,7 @@ interface TestBinding {
|
|||
void passOptionalString(optional DOMString arg);
|
||||
// void passOptionalEnum(optional TestEnum arg);
|
||||
void passOptionalInterface(optional Blob arg);
|
||||
// void passOptionalUnion(optional (HTMLElement or long) arg);
|
||||
void passOptionalUnion(optional (HTMLElement or long) arg);
|
||||
void passOptionalAny(optional any arg);
|
||||
|
||||
void passOptionalNullableBoolean(optional boolean? arg);
|
||||
|
@ -151,7 +151,7 @@ interface TestBinding {
|
|||
void passOptionalNullableString(optional DOMString? arg);
|
||||
// void passOptionalNullableEnum(optional TestEnum? arg);
|
||||
// void passOptionalNullableInterface(optional Blob? arg);
|
||||
// void passOptionalNullableUnion(optional (HTMLElement or long)? arg);
|
||||
void passOptionalNullableUnion(optional (HTMLElement or long)? arg);
|
||||
|
||||
void passOptionalBooleanWithDefault(optional boolean arg = false);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue