servo: Merge #19133 - Import sequence inner types if it appears in dictionary members (from KiChjang:import-sequence-inner-types); r=jdm

Fixes #19107.

r? nox

Source-Repo: https://github.com/servo/servo
Source-Revision: 7ae852b6731f7405a101e01881c7fa70cfb83826

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 3df32aba9f6b0b5fa035c1f4c8bd2d15625a14c8
This commit is contained in:
Keith Yeung 2017-11-07 17:07:03 -06:00
Родитель 6e2598919b
Коммит dfbda4212b
3 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -4,7 +4,7 @@
import os
from WebIDL import IDLExternalInterface, IDLWrapperType, WebIDLError
from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError
class Configuration:
@ -457,7 +457,7 @@ def getTypesFromDictionary(dictionary):
types = []
curDict = dictionary
while curDict:
types.extend([m.type for m in curDict.members])
types.extend([getUnwrappedType(m.type) for m in curDict.members])
curDict = curDict.parent
return types
@ -473,6 +473,12 @@ def getTypesFromCallback(callback):
return types
def getUnwrappedType(type):
if isinstance(type, IDLSequenceType):
return type.inner
return type
def iteratorNativeType(descriptor, infer=False):
assert descriptor.interface.isIterable()
iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable

Просмотреть файл

@ -390,6 +390,7 @@ impl TestBindingMethods for TestBinding {
octetValue: None,
requiredValue: true,
seqDict: None,
elementSequence: None,
shortValue: None,
stringValue: None,
type_: Some(DOMString::from("success")),

Просмотреть файл

@ -34,6 +34,8 @@ dictionary TestDictionary {
object objectValue;
TestDictionaryDefaults dict;
sequence<TestDictionaryDefaults> seqDict;
// Testing codegen to import Element correctly, ensure no other code references Element directly
sequence<Element> elementSequence;
// Reserved rust keyword
DOMString type;
// These are used to test bidirectional conversion