| Index: sdk/lib/html/dartium/html_dartium.dart
|
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
|
| index 8a68d79c9255b9788e1e12373abfeaf2de94c06e..ce0c68ce9d45dc1df2d2d132eb23837be7ec64d2 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -6939,7 +6939,7 @@ class DOMMimeTypeArray extends NativeFieldWrapperClass1 implements List<DOMMimeT
|
|
|
| // 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.
|
| @@ -7100,7 +7100,7 @@ class DOMPluginArray extends NativeFieldWrapperClass1 implements List<DOMPlugin>
|
|
|
| // 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.
|
| @@ -8839,7 +8839,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) {
|
| @@ -8976,7 +8976,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('');
|
| @@ -9025,21 +9025,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");
|
| + }
|
| }
|
|
|
| /**
|
| @@ -10944,7 +10952,7 @@ class Float32Array extends ArrayBufferView implements List<num> {
|
|
|
| // 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.
|
| @@ -11075,7 +11083,7 @@ class Float64Array extends ArrayBufferView implements List<num> {
|
|
|
| // 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.
|
| @@ -11652,7 +11660,7 @@ class HTMLAllCollection extends NativeFieldWrapperClass1 implements List<Node> {
|
|
|
| // 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.
|
| @@ -11763,7 +11771,7 @@ class HTMLCollection extends NativeFieldWrapperClass1 implements List<Node> {
|
|
|
| // 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.
|
| @@ -14006,7 +14014,7 @@ class Int16Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -14137,7 +14145,7 @@ class Int32Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -14268,7 +14276,7 @@ class Int8Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -17167,7 +17175,7 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> {
|
|
|
| // 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.
|
| @@ -17445,7 +17453,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.
|
| @@ -17776,7 +17784,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);
|
|
|
| @@ -17856,7 +17864,7 @@ class NodeList extends NativeFieldWrapperClass1 implements List<Node> {
|
|
|
| // 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.
|
| @@ -20182,7 +20190,7 @@ class SQLResultSetRowList extends NativeFieldWrapperClass1 implements List<Map>
|
|
|
| // 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.
|
| @@ -20900,7 +20908,7 @@ class SourceBufferList extends EventTarget implements List<SourceBuffer> {
|
|
|
| // 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.
|
| @@ -21099,7 +21107,7 @@ class SpeechGrammarList extends NativeFieldWrapperClass1 implements List<SpeechG
|
|
|
| // 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.
|
| @@ -22760,7 +22768,7 @@ class TextTrackCueList extends NativeFieldWrapperClass1 implements List<TextTrac
|
|
|
| // 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.
|
| @@ -22873,7 +22881,7 @@ class TextTrackList extends EventTarget implements List<TextTrack> {
|
|
|
| // 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.
|
| @@ -23144,7 +23152,7 @@ class TouchList extends NativeFieldWrapperClass1 implements List<Touch> {
|
|
|
| // 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.
|
| @@ -23512,7 +23520,7 @@ class Uint16Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -23643,7 +23651,7 @@ class Uint32Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -23774,7 +23782,7 @@ class Uint8Array extends ArrayBufferView implements List<int> {
|
|
|
| // 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.
|
| @@ -26458,7 +26466,7 @@ class _CSSRuleList extends NativeFieldWrapperClass1 implements List<CSSRule> {
|
|
|
| // 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.
|
| @@ -26561,7 +26569,7 @@ class _CSSValueList extends CSSValue implements List<CSSValue> {
|
|
|
| // 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.
|
| @@ -26664,7 +26672,7 @@ class _ClientRectList extends NativeFieldWrapperClass1 implements List<ClientRec
|
|
|
| // 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.
|
| @@ -26775,7 +26783,7 @@ class _DOMStringList extends NativeFieldWrapperClass1 implements List<String> {
|
|
|
| // 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.
|
| @@ -27347,7 +27355,7 @@ class _EntryArray extends NativeFieldWrapperClass1 implements List<Entry> {
|
|
|
| // 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.
|
| @@ -27450,7 +27458,7 @@ class _EntryArraySync extends NativeFieldWrapperClass1 implements List<EntrySync
|
|
|
| // 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.
|
| @@ -27561,7 +27569,7 @@ class _FileList extends NativeFieldWrapperClass1 implements List<File> {
|
|
|
| // 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.
|
| @@ -27688,7 +27696,7 @@ class _GamepadList extends NativeFieldWrapperClass1 implements List<Gamepad> {
|
|
|
| // 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.
|
| @@ -27840,7 +27848,7 @@ class _MediaStreamList extends NativeFieldWrapperClass1 implements List<MediaStr
|
|
|
| // 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.
|
| @@ -28047,7 +28055,7 @@ class _SpeechInputResultList extends NativeFieldWrapperClass1 implements List<Sp
|
|
|
| // 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.
|
| @@ -28158,7 +28166,7 @@ class _SpeechRecognitionResultList extends NativeFieldWrapperClass1 implements L
|
|
|
| // 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.
|
| @@ -28261,7 +28269,7 @@ class _StyleSheetList extends NativeFieldWrapperClass1 implements List<StyleShee
|
|
|
| // 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.
|
| @@ -28372,7 +28380,7 @@ class _WebKitAnimationList extends NativeFieldWrapperClass1 implements List<Anim
|
|
|
| // 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.
|
| @@ -29592,7 +29600,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
|
|
|