diff options
author | Josh Matthews <josh@joshmatthews.net> | 2016-07-28 18:41:24 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2016-08-24 11:26:00 -0400 |
commit | 34bb937aeea9a48b1b4d8dc7c49f375203be4e7e (patch) | |
tree | 599099dc8793e3b553bc14782f143f670ebce124 /components/script/dom/bindings/codegen | |
parent | 221bc846935a321747fff30689218de7543c964b (diff) | |
download | servo-34bb937aeea9a48b1b4d8dc7c49f375203be4e7e.tar.gz servo-34bb937aeea9a48b1b4d8dc7c49f375203be4e7e.zip |
Support value iterators in WebIDL interfaces.
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 56a20677691..bd41a214740 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1519,6 +1519,46 @@ class MethodDefiner(PropertyDefiner): "length": 0, "condition": "Condition::Satisfied"}) + # Generate the keys/values/entries aliases for value iterables. + maplikeOrSetlikeOrIterable = descriptor.interface.maplikeOrSetlikeOrIterable + if (not static and not unforgeable and + (maplikeOrSetlikeOrIterable and + maplikeOrSetlikeOrIterable.isIterable() and + maplikeOrSetlikeOrIterable.isValueIterator())): + # Add our keys/values/entries/forEach + self.regular.append({ + "name": "keys", + "methodInfo": False, + "selfHostedName": "ArrayKeys", + "length": 0, + "condition": PropertyDefiner.getControllingCondition(m, + descriptor) + }) + self.regular.append({ + "name": "values", + "methodInfo": False, + "selfHostedName": "ArrayValues", + "length": 0, + "condition": PropertyDefiner.getControllingCondition(m, + descriptor) + }) + self.regular.append({ + "name": "entries", + "methodInfo": False, + "selfHostedName": "ArrayEntries", + "length": 0, + "condition": PropertyDefiner.getControllingCondition(m, + descriptor) + }) + self.regular.append({ + "name": "forEach", + "methodInfo": False, + "selfHostedName": "ArrayForEach", + "length": 0, + "condition": PropertyDefiner.getControllingCondition(m, + descriptor) + }) + isUnforgeableInterface = bool(descriptor.interface.getExtendedAttribute("Unforgeable")) if not static and unforgeable == isUnforgeableInterface: stringifier = descriptor.operations['Stringifier'] |