| 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 d256c83cbbc8f907e5241a32bbf3fa6f4b651d04..00148eabce2fd29933b9c02724bd37ed9e931836 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -6938,7 +6938,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.
|
| @@ -7099,7 +7099,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.
|
| @@ -8838,7 +8838,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) {
|
| @@ -8975,7 +8975,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('');
|
| @@ -9024,21 +9024,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");
|
| + }
|
| }
|
|
|
| /**
|
| @@ -10943,7 +10951,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.
|
| @@ -11074,7 +11082,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.
|
| @@ -11651,7 +11659,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.
|
| @@ -11762,7 +11770,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.
|
| @@ -14005,7 +14013,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.
|
| @@ -14136,7 +14144,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.
|
| @@ -14267,7 +14275,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.
|
| @@ -17166,7 +17174,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.
|
| @@ -17444,7 +17452,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.
|
| @@ -17775,7 +17783,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);
|
|
|
| @@ -17855,7 +17863,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.
|
| @@ -20181,7 +20189,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.
|
| @@ -20899,7 +20907,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.
|
| @@ -21098,7 +21106,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.
|
| @@ -22759,7 +22767,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.
|
| @@ -22872,7 +22880,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.
|
| @@ -23143,7 +23151,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.
|
| @@ -23511,7 +23519,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.
|
| @@ -23642,7 +23650,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.
|
| @@ -23773,7 +23781,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.
|
| @@ -26457,7 +26465,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.
|
| @@ -26560,7 +26568,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.
|
| @@ -26663,7 +26671,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.
|
| @@ -26774,7 +26782,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.
|
| @@ -27346,7 +27354,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.
|
| @@ -27449,7 +27457,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.
|
| @@ -27560,7 +27568,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.
|
| @@ -27687,7 +27695,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.
|
| @@ -27839,7 +27847,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.
|
| @@ -28046,7 +28054,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.
|
| @@ -28157,7 +28165,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.
|
| @@ -28260,7 +28268,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.
|
| @@ -28371,7 +28379,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.
|
| @@ -29591,7 +29599,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
|
|
|