Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: pkg/compiler/lib/src/util/link.dart

Issue 1783053005: Fix all for-in warnings in dart2js (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.util; 5 part of dart2js.util;
6 6
7 class Link<T> { 7 class Link<T> implements Iterable<T> {
8 T get head => throw new StateError("no elements"); 8 T get head => throw new StateError("no elements");
9 Link<T> get tail => null; 9 Link<T> get tail => null;
10 10
11 const Link(); 11 const Link();
12 12
13 Link<T> prepend(T element) { 13 Link<T> prepend(T element) {
14 return new LinkEntry<T>(element, this); 14 return new LinkEntry<T>(element, this);
15 } 15 }
16 16
17 Iterator<T> get iterator => new LinkIterator<T>(this); 17 Iterator<T> get iterator => new LinkIterator<T>(this);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 /// 113 ///
114 /// Returns true for the empty list. 114 /// Returns true for the empty list.
115 bool every(bool f(T)) { 115 bool every(bool f(T)) {
116 for (Link<T> link = this; !link.isEmpty; link = link.tail){ 116 for (Link<T> link = this; !link.isEmpty; link = link.tail){
117 if (!f(link.head)) return false; 117 if (!f(link.head)) return false;
118 } 118 }
119 return true; 119 return true;
120 } 120 }
121 121
122 Link copyWithout(e) => this; 122 Link copyWithout(e) => this;
123
124 //
125 // Unsupported Iterable<T> methods.
126 //
127 bool any(bool f(T e)) => _unsupported('any');
128 T elementAt(int i) => _unsupported('elementAt');
129 Iterable expand(Iterable f(T e)) => _unsupported('expand');
130 T firstWhere(bool f(T e), {T orElse()}) => _unsupported('firstWhere');
131 fold(initialValue, combine(value, T element)) => _unsupported('fold');
132 T get last => _unsupported('get:last');
133 T lastWhere(bool f(T e), {T orElse()}) => _unsupported('lastWhere');
134 String join([separator = '']) => _unsupported('join');
135 T reduce(T combine(T a, T b)) => _unsupported('reduce');
136 T singleWhere(bool f(T e)) => _unsupported('singleWhere');
137 Iterable<T> skipWhile(bool f(T e)) => _unsupported('skipWhile');
138 Iterable<T> take(int n) => _unsupported('take');
139 Iterable<T> takeWhile(bool f(T e)) => _unsupported('takeWhile');
140 Set<T> toSet() => _unsupported('toSet');
141 Iterable<T> where(bool f(T e)) => _unsupported('where');
142
143 _unsupported(String method) => throw new UnsupportedError(method);
123 } 144 }
124 145
125 /// Builder object for creating linked lists using [Link] or fixed-length [List] 146 /// Builder object for creating linked lists using [Link] or fixed-length [List]
126 /// objects. 147 /// objects.
127 abstract class LinkBuilder<T> { 148 abstract class LinkBuilder<T> {
128 factory LinkBuilder() = LinkBuilderImplementation; 149 factory LinkBuilder() = LinkBuilderImplementation;
129 150
130 /// Prepends all elements added to the builder to [tail]. The resulting list 151 /// Prepends all elements added to the builder to [tail]. The resulting list
131 /// is returned and the builder is cleared. 152 /// is returned and the builder is cleared.
132 Link<T> toLink([Link<T> tail = const Link()]); 153 Link<T> toLink([Link<T> tail = const Link()]);
(...skipping 10 matching lines...) Expand all
143 164
144 /// Returns the number of elements in the list being built. 165 /// Returns the number of elements in the list being built.
145 final int length; 166 final int length;
146 167
147 /// Returns `true` if the list being built is empty. 168 /// Returns `true` if the list being built is empty.
148 final bool isEmpty; 169 final bool isEmpty;
149 170
150 /// Removes all added elements and resets the builder. 171 /// Removes all added elements and resets the builder.
151 void clear(); 172 void clear();
152 } 173 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698