mirror of
https://github.com/servo/servo.git
synced 2025-07-12 18:03:49 +01:00
Import sequence inner types if it appears in dictionary members
This commit is contained in:
parent
4decea188f
commit
fe73122416
3 changed files with 11 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from WebIDL import IDLExternalInterface, IDLWrapperType, WebIDLError
|
from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError
|
||||||
|
|
||||||
|
|
||||||
class Configuration:
|
class Configuration:
|
||||||
|
@ -457,7 +457,7 @@ def getTypesFromDictionary(dictionary):
|
||||||
types = []
|
types = []
|
||||||
curDict = dictionary
|
curDict = dictionary
|
||||||
while curDict:
|
while curDict:
|
||||||
types.extend([m.type for m in curDict.members])
|
types.extend([getUnwrappedType(m.type) for m in curDict.members])
|
||||||
curDict = curDict.parent
|
curDict = curDict.parent
|
||||||
return types
|
return types
|
||||||
|
|
||||||
|
@ -473,6 +473,12 @@ def getTypesFromCallback(callback):
|
||||||
return types
|
return types
|
||||||
|
|
||||||
|
|
||||||
|
def getUnwrappedType(type):
|
||||||
|
if isinstance(type, IDLSequenceType):
|
||||||
|
return type.inner
|
||||||
|
return type
|
||||||
|
|
||||||
|
|
||||||
def iteratorNativeType(descriptor, infer=False):
|
def iteratorNativeType(descriptor, infer=False):
|
||||||
assert descriptor.interface.isIterable()
|
assert descriptor.interface.isIterable()
|
||||||
iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable
|
iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable
|
||||||
|
|
|
@ -390,6 +390,7 @@ impl TestBindingMethods for TestBinding {
|
||||||
octetValue: None,
|
octetValue: None,
|
||||||
requiredValue: true,
|
requiredValue: true,
|
||||||
seqDict: None,
|
seqDict: None,
|
||||||
|
elementSequence: None,
|
||||||
shortValue: None,
|
shortValue: None,
|
||||||
stringValue: None,
|
stringValue: None,
|
||||||
type_: Some(DOMString::from("success")),
|
type_: Some(DOMString::from("success")),
|
||||||
|
|
|
@ -34,6 +34,8 @@ dictionary TestDictionary {
|
||||||
object objectValue;
|
object objectValue;
|
||||||
TestDictionaryDefaults dict;
|
TestDictionaryDefaults dict;
|
||||||
sequence<TestDictionaryDefaults> seqDict;
|
sequence<TestDictionaryDefaults> seqDict;
|
||||||
|
// Testing codegen to import Element correctly, ensure no other code references Element directly
|
||||||
|
sequence<Element> elementSequence;
|
||||||
// Reserved rust keyword
|
// Reserved rust keyword
|
||||||
DOMString type;
|
DOMString type;
|
||||||
// These are used to test bidirectional conversion
|
// These are used to test bidirectional conversion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue