diff options
author | Keith Yeung <kungfukeith11@gmail.com> | 2017-11-06 22:52:40 -0800 |
---|---|---|
committer | Keith Yeung <kungfukeith11@gmail.com> | 2017-11-08 04:20:30 -0800 |
commit | ce8486ab9b3af974a7c738a08a9da460360ce117 (patch) | |
tree | 22ad3650e2def68cfc81dab4376d6f90ef72ea54 /components/script/dom | |
parent | 4decea188feb87b880fd2b0663b86d262a346a18 (diff) | |
download | servo-ce8486ab9b3af974a7c738a08a9da460360ce117.tar.gz servo-ce8486ab9b3af974a7c738a08a9da460360ce117.zip |
Import sequence inner types if it appears in dictionary members
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/codegen/Configuration.py | 10 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 1 | ||||
-rw-r--r-- | components/script/dom/webidls/TestBinding.webidl | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index 56141e52b09..0ab27151bb6 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -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): + while isinstance(type, IDLSequenceType): + type = type.inner + return type + + def iteratorNativeType(descriptor, infer=False): assert descriptor.interface.isIterable() iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index ce8bce56878..9a8f9633072 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -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")), diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index 3e6be1b4edd..4fc1ba4d414 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -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 |