| Index: sdk/lib/html/dart2js/html_dart2js.dart
|
| diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
|
| index dc0572c3db94d35a75c304bef86dea629f785630..fcf232e1a23b19832762f3ebd6ede35e77a9169a 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -5311,7 +5311,7 @@ class DOMMimeTypeArray implements JavaScriptIndexingBehavior, List<DOMMimeType>
|
|
|
| // From Iterable<DOMMimeType>:
|
|
|
| - Iterator<DOMMimeType> iterator() {
|
| + Iterator<DOMMimeType> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -5450,7 +5450,7 @@ class DOMPluginArray implements JavaScriptIndexingBehavior, List<DOMPlugin> nati
|
|
|
| // From Iterable<DOMPlugin>:
|
|
|
| - Iterator<DOMPlugin> iterator() {
|
| + Iterator<DOMPlugin> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -6802,7 +6802,7 @@ class _ChildrenElementList implements List {
|
|
|
| Element addLast(Element value) => add(value);
|
|
|
| - Iterator<Element> iterator() => _toList().iterator();
|
| + Iterator<Element> get iterator => _toList().iterator;
|
|
|
| void addAll(Collection<Element> collection) {
|
| for (Element element in collection) {
|
| @@ -6939,7 +6939,7 @@ class _FrozenElementList implements List {
|
| throw new UnsupportedError('');
|
| }
|
|
|
| - Iterator<Element> iterator() => new _FrozenElementListIterator(this);
|
| + Iterator<Element> get iterator => new _FrozenElementListIterator(this);
|
|
|
| void addAll(Collection<Element> collection) {
|
| throw new UnsupportedError('');
|
| @@ -6988,21 +6988,29 @@ class _FrozenElementListIterator implements Iterator<Element> {
|
| _FrozenElementListIterator(this._list);
|
|
|
| /**
|
| - * Gets the next element in the iteration. Throws a
|
| - * [StateError("No more elements")] if no element is left.
|
| + * Moves to the next element. Returns true if the iterator is positioned
|
| + * at an element. Returns false if it is positioned after the last element.
|
| */
|
| - Element next() {
|
| - if (!hasNext) {
|
| - throw new StateError("No more elements");
|
| - }
|
| -
|
| - return _list[_index++];
|
| + bool moveNext() {
|
| + _index++;
|
| + if (_index < _list.length) return true;
|
| + _index = _list.length;
|
| + return false;
|
| }
|
|
|
| /**
|
| - * Returns whether the [Iterator] has elements left.
|
| + * Returns the element the [Iterator] is positioned at.
|
| + *
|
| + * Throws a [StateError] if the iterator is positioned before the first, or
|
| + * after the last element.
|
| */
|
| - bool get hasNext => _index < _list.length;
|
| + bool get current {
|
| + if (0 <= _index && _index < _list.length) {
|
| + return _list[_index];
|
| + }
|
| + // TODO(floitsch): adapt the error message.
|
| + throw new StateError("No more elements");
|
| + }
|
| }
|
|
|
| /**
|
| @@ -8595,7 +8603,7 @@ class Float32Array extends ArrayBufferView implements JavaScriptIndexingBehavior
|
|
|
| // From Iterable<num>:
|
|
|
| - Iterator<num> iterator() {
|
| + Iterator<num> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -8704,7 +8712,7 @@ class Float64Array extends ArrayBufferView implements JavaScriptIndexingBehavior
|
|
|
| // From Iterable<num>:
|
|
|
| - Iterator<num> iterator() {
|
| + Iterator<num> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -9070,7 +9078,7 @@ class HTMLAllCollection implements JavaScriptIndexingBehavior, List<Node> native
|
|
|
| // From Iterable<Node>:
|
|
|
| - Iterator<Node> iterator() {
|
| + Iterator<Node> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -9173,7 +9181,7 @@ class HTMLCollection implements JavaScriptIndexingBehavior, List<Node> native "*
|
|
|
| // From Iterable<Node>:
|
|
|
| - Iterator<Node> iterator() {
|
| + Iterator<Node> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -10741,7 +10749,7 @@ class Int16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -10850,7 +10858,7 @@ class Int32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -10959,7 +10967,7 @@ class Int8Array extends ArrayBufferView implements JavaScriptIndexingBehavior, L
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -13109,7 +13117,7 @@ class NamedNodeMap implements JavaScriptIndexingBehavior, List<Node> native "*Na
|
|
|
| // From Iterable<Node>:
|
|
|
| - Iterator<Node> iterator() {
|
| + Iterator<Node> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -13361,7 +13369,7 @@ class _ChildNodeListLazy implements List {
|
| _this.$dom_replaceChild(value, this[index]);
|
| }
|
|
|
| - Iterator<Node> iterator() => _this.$dom_childNodes.iterator();
|
| + Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
|
|
|
| // TODO(jacobr): We can implement these methods much more efficiently by
|
| // looking up the nodeList only once instead of once per iteration.
|
| @@ -13654,7 +13662,7 @@ class _ListWrapper<E> implements List<E> {
|
|
|
| _ListWrapper(List this._list);
|
|
|
| - Iterator<E> iterator() => _list.iterator();
|
| + Iterator<E> get iterator => _list.iterator;
|
|
|
| bool contains(E element) => _list.contains(element);
|
|
|
| @@ -13734,7 +13742,7 @@ class NodeList implements JavaScriptIndexingBehavior, List<Node> native "*NodeLi
|
|
|
| // From Iterable<Node>:
|
|
|
| - Iterator<Node> iterator() {
|
| + Iterator<Node> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -15425,7 +15433,7 @@ class SQLResultSetRowList implements JavaScriptIndexingBehavior, List<Map> nativ
|
|
|
| // From Iterable<Map>:
|
|
|
| - Iterator<Map> iterator() {
|
| + Iterator<Map> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -15939,7 +15947,7 @@ class SourceBufferList extends EventTarget implements JavaScriptIndexingBehavior
|
|
|
| // From Iterable<SourceBuffer>:
|
|
|
| - Iterator<SourceBuffer> iterator() {
|
| + Iterator<SourceBuffer> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -16092,7 +16100,7 @@ class SpeechGrammarList implements JavaScriptIndexingBehavior, List<SpeechGramma
|
|
|
| // From Iterable<SpeechGrammar>:
|
|
|
| - Iterator<SpeechGrammar> iterator() {
|
| + Iterator<SpeechGrammar> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17111,7 +17119,7 @@ class TextTrackCueList implements List<TextTrackCue>, JavaScriptIndexingBehavior
|
|
|
| // From Iterable<TextTrackCue>:
|
|
|
| - Iterator<TextTrackCue> iterator() {
|
| + Iterator<TextTrackCue> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17217,7 +17225,7 @@ class TextTrackList extends EventTarget implements JavaScriptIndexingBehavior, L
|
|
|
| // From Iterable<TextTrack>:
|
|
|
| - Iterator<TextTrack> iterator() {
|
| + Iterator<TextTrack> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17441,7 +17449,7 @@ class TouchList implements JavaScriptIndexingBehavior, List<Touch> native "*Touc
|
|
|
| // From Iterable<Touch>:
|
|
|
| - Iterator<Touch> iterator() {
|
| + Iterator<Touch> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17715,7 +17723,7 @@ class Uint16Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17824,7 +17832,7 @@ class Uint32Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -17933,7 +17941,7 @@ class Uint8Array extends ArrayBufferView implements JavaScriptIndexingBehavior,
|
|
|
| // From Iterable<int>:
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20119,7 +20127,7 @@ class _CSSRuleList implements JavaScriptIndexingBehavior, List<CSSRule> native "
|
|
|
| // From Iterable<CSSRule>:
|
|
|
| - Iterator<CSSRule> iterator() {
|
| + Iterator<CSSRule> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20216,7 +20224,7 @@ class _CSSValueList extends CSSValue implements List<CSSValue>, JavaScriptIndexi
|
|
|
| // From Iterable<CSSValue>:
|
|
|
| - Iterator<CSSValue> iterator() {
|
| + Iterator<CSSValue> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20313,7 +20321,7 @@ class _ClientRectList implements JavaScriptIndexingBehavior, List<ClientRect> na
|
|
|
| // From Iterable<ClientRect>:
|
|
|
| - Iterator<ClientRect> iterator() {
|
| + Iterator<ClientRect> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20419,7 +20427,7 @@ class _DOMStringList implements JavaScriptIndexingBehavior, List<String> native
|
|
|
| // From Iterable<String>:
|
|
|
| - Iterator<String> iterator() {
|
| + Iterator<String> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20841,7 +20849,7 @@ class _EntryArray implements JavaScriptIndexingBehavior, List<Entry> native "*En
|
|
|
| // From Iterable<Entry>:
|
|
|
| - Iterator<Entry> iterator() {
|
| + Iterator<Entry> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -20938,7 +20946,7 @@ class _EntryArraySync implements JavaScriptIndexingBehavior, List<EntrySync> nat
|
|
|
| // From Iterable<EntrySync>:
|
|
|
| - Iterator<EntrySync> iterator() {
|
| + Iterator<EntrySync> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21044,7 +21052,7 @@ class _FileList implements JavaScriptIndexingBehavior, List<File> native "*FileL
|
|
|
| // From Iterable<File>:
|
|
|
| - Iterator<File> iterator() {
|
| + Iterator<File> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21170,7 +21178,7 @@ class _GamepadList implements JavaScriptIndexingBehavior, List<Gamepad> native "
|
|
|
| // From Iterable<Gamepad>:
|
|
|
| - Iterator<Gamepad> iterator() {
|
| + Iterator<Gamepad> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21320,7 +21328,7 @@ class _MediaStreamList implements JavaScriptIndexingBehavior, List<MediaStream>
|
|
|
| // From Iterable<MediaStream>:
|
|
|
| - Iterator<MediaStream> iterator() {
|
| + Iterator<MediaStream> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21580,7 +21588,7 @@ class _SpeechInputResultList implements JavaScriptIndexingBehavior, List<SpeechI
|
|
|
| // From Iterable<SpeechInputResult>:
|
|
|
| - Iterator<SpeechInputResult> iterator() {
|
| + Iterator<SpeechInputResult> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21686,7 +21694,7 @@ class _SpeechRecognitionResultList implements JavaScriptIndexingBehavior, List<S
|
|
|
| // From Iterable<SpeechRecognitionResult>:
|
|
|
| - Iterator<SpeechRecognitionResult> iterator() {
|
| + Iterator<SpeechRecognitionResult> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21783,7 +21791,7 @@ class _StyleSheetList implements JavaScriptIndexingBehavior, List<StyleSheet> na
|
|
|
| // From Iterable<StyleSheet>:
|
|
|
| - Iterator<StyleSheet> iterator() {
|
| + Iterator<StyleSheet> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -21904,7 +21912,7 @@ class _WebKitAnimationList implements JavaScriptIndexingBehavior, List<Animation
|
|
|
| // From Iterable<Animation>:
|
|
|
| - Iterator<Animation> iterator() {
|
| + Iterator<Animation> get iterator {
|
| // Note: NodeLists are not fixed size. And most probably length shouldn't
|
| // be cached in both iterator _and_ forEach method. For now caching it
|
| // for consistency.
|
| @@ -23162,7 +23170,7 @@ class _Collections {
|
| }
|
|
|
| static bool isEmpty(Iterable<Object> iterable) {
|
| - return !iterable.iterator().hasNext;
|
| + return !iterable.iterator.moveNext();
|
| }
|
| }
|
| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
|