mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 963388. Add support for nullable dictionary return values in callbacks and js-implemented bindings. r=peterv
This commit is contained in:
parent
da001d4b79
commit
4d16883304
@ -3844,12 +3844,15 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
|
||||
if type.isDictionary():
|
||||
# There are no nullable dictionaries
|
||||
assert not type.nullable()
|
||||
assert not type.nullable() or isCallbackReturnValue
|
||||
# All optional dictionaries always have default values, so we
|
||||
# should be able to assume not isOptional here.
|
||||
assert not isOptional
|
||||
# In the callback return value case we never have to worry
|
||||
# about a default value; we always have a value.
|
||||
assert not isCallbackReturnValue or defaultValue is None
|
||||
|
||||
typeName = CGDictionary.makeDictionaryName(type.inner)
|
||||
typeName = CGDictionary.makeDictionaryName(type.unroll().inner)
|
||||
if not isMember and not isCallbackReturnValue:
|
||||
# Since we're not a member and not nullable or optional, no one will
|
||||
# see our real type, so we can do the fast version of the dictionary
|
||||
@ -3883,11 +3886,21 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
else:
|
||||
template = ""
|
||||
|
||||
template += ('if (!${declName}.Init(cx, %s, "%s")) {\n'
|
||||
dictLoc = "${declName}"
|
||||
if type.nullable():
|
||||
dictLoc += ".SetValue()"
|
||||
|
||||
template += ('if (!%s.Init(cx, %s, "%s")) {\n'
|
||||
"%s\n"
|
||||
"}" % (val, firstCap(sourceDescription),
|
||||
"}" % (dictLoc, val, firstCap(sourceDescription),
|
||||
exceptionCodeIndented.define()))
|
||||
|
||||
if type.nullable():
|
||||
declType = CGTemplatedType("Nullable", declType)
|
||||
template = CGIfElseWrapper("${val}.isNullOrUndefined()",
|
||||
CGGeneric("${declName}.SetNull();"),
|
||||
CGGeneric(template)).define()
|
||||
|
||||
# Dictionary arguments that might contain traceable things need to get
|
||||
# traced
|
||||
if not isMember and isCallbackReturnValue:
|
||||
|
@ -29,6 +29,7 @@ callback interface TestCallbackInterface {
|
||||
sequence<TestCallbackInterface>? getNullableSequenceOfCallbackInterfaces();
|
||||
sequence<TestCallbackInterface?> getSequenceOfNullableCallbackInterfaces();
|
||||
sequence<TestCallbackInterface?>? getNullableSequenceOfNullableCallbackInterfaces();
|
||||
Dict? getDictionary();
|
||||
};
|
||||
|
||||
callback interface TestSingleOperationCallbackInterface {
|
||||
|
@ -469,21 +469,18 @@ interface TestJSImplInterface {
|
||||
void passDictionary(optional Dict x);
|
||||
[Cached, Pure]
|
||||
readonly attribute Dict readonlyDictionary;
|
||||
// No support for nullable dictionary return values here yet
|
||||
// [Cached, Pure]
|
||||
// readonly attribute Dict? readonlyNullableDictionary;
|
||||
[Cached, Pure]
|
||||
readonly attribute Dict? readonlyNullableDictionary;
|
||||
[Cached, Pure]
|
||||
attribute Dict writableDictionary;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute Dict readonlyFrozenDictionary;
|
||||
// No support for nullable dictionary return values here yet
|
||||
// [Cached, Pure, Frozen]
|
||||
// readonly attribute Dict? readonlyFrozenNullableDictionary;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute Dict? readonlyFrozenNullableDictionary;
|
||||
[Cached, Pure, Frozen]
|
||||
attribute Dict writableFrozenDictionary;
|
||||
Dict receiveDictionary();
|
||||
// No support for nullable dictionary return values here yet
|
||||
// Dict? receiveNullableDictionary();
|
||||
Dict? receiveNullableDictionary();
|
||||
void passOtherDictionary(optional GrandparentDict x);
|
||||
void passSequenceOfDictionaries(sequence<Dict> x);
|
||||
// No support for nullable dictionaries inside a sequence (nor should there be)
|
||||
|
Loading…
Reference in New Issue
Block a user