mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
script: Ensure promises are considered DOM interfaces when generating bindings. (#36107)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
8c2ac88ad0
commit
4814cbdb1f
2 changed files with 5 additions and 3 deletions
|
@ -74,7 +74,7 @@ def isDomInterface(t, logging=False):
|
||||||
t = t.inner
|
t = t.inner
|
||||||
if isinstance(t, IDLInterface):
|
if isinstance(t, IDLInterface):
|
||||||
return True
|
return True
|
||||||
if t.isCallback():
|
if t.isCallback() or t.isPromise():
|
||||||
return True
|
return True
|
||||||
return t.isInterface() and (t.isGeckoInterface() or (t.isSpiderMonkeyInterface() and not t.isBufferSource()))
|
return t.isInterface() and (t.isGeckoInterface() or (t.isSpiderMonkeyInterface() and not t.isBufferSource()))
|
||||||
|
|
||||||
|
@ -88,12 +88,12 @@ def containsDomInterface(t, logging=False):
|
||||||
t = t.inner
|
t = t.inner
|
||||||
if t.isEnum():
|
if t.isEnum():
|
||||||
return False
|
return False
|
||||||
if isDomInterface(t):
|
|
||||||
return True
|
|
||||||
if t.isUnion():
|
if t.isUnion():
|
||||||
return any(map(lambda x: containsDomInterface(x), t.flatMemberTypes))
|
return any(map(lambda x: containsDomInterface(x), t.flatMemberTypes))
|
||||||
if t.isDictionary():
|
if t.isDictionary():
|
||||||
return any(map(lambda x: containsDomInterface(x), t.members)) or (t.parent and containsDomInterface(t.parent))
|
return any(map(lambda x: containsDomInterface(x), t.members)) or (t.parent and containsDomInterface(t.parent))
|
||||||
|
if isDomInterface(t):
|
||||||
|
return True
|
||||||
if t.isSequence():
|
if t.isSequence():
|
||||||
return containsDomInterface(t.inner)
|
return containsDomInterface(t.inner)
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -616,3 +616,5 @@ namespace TestNS {
|
||||||
const unsigned long ONE = 1;
|
const unsigned long ONE = 1;
|
||||||
const unsigned long TWO = 0x2;
|
const unsigned long TWO = 0x2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef Promise<undefined> PromiseUndefined;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue