Descriptionbindings: Use an alias for @@iterator in certain declarations.
So far, the generated bindings had completely separate methods for
entries(), values() and the @@iterator symbol, all of which were added
automatically if an IDL has an iterable<>, maplike<> or setlike<>
declaration.
However, the WebIDL spec states that:
* Pair iterators (iterable<K,V>) and maplike declarations (maplike<K,V>)
should add the same Function object for both @@iterator and entries(), and
its name attribute should be "entries".
* Setlike declarations (setlike<V>) should add the same Function object for
both @@iterator and values(), and its name attribute should be "values".
Fix it by adding SymbolKeyedMethodConfiguration::symbol_alias, an optional
string that can be used to add the same function template as both a symbol
as well as this string (which will also be used as the Function object's
name attribute).
While here, bring back a simpler version of the ValueIterable class removed
in commit c85bc0151 ("bindings: Make some value iterator properties aliases
to Array.prototype functions") and call it SetlikeIterable instead. As the
name suggests, we need it for interfaces with setlike declarations instead
of "iterable<V>" declarations: the latter uses the definitions from
%ArrayPrototype%, while the former do not.
SetlikeIterable is currently used by FontFaceSet, which is our only IDL with
a setlike declaration and whose C++ implementation was previously inheriting
from PairIterable, leading @@iterator to call entriesForBinding() instead of
valuesForBinding() instead.
BUG=723648
R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org
Review-Url: https://codereview.chromium.org/2891063003
Cr-Commit-Position: refs/heads/master@{#473558}
Committed: https://chromium.googlesource.com/chromium/src/+/1bd6e150922b18cd1fa5e0f14482ecf691ba3377
Patch Set 1 #Patch Set 2 : Fix failing tests, add SetlikeIterable #
Total comments: 2
Patch Set 3 : Make methods_context() return a dict #Patch Set 4 : Rebase patch #Messages
Total messages: 22 (13 generated)
|