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

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

Issue 1302333006: Support metadata on patches. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove partial renaming Created 5 years, 3 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
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> {
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
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 123 }
124 124
125 /// Builder object for creating linked lists using [Link] or fixed-length [List]
126 /// objects.
125 abstract class LinkBuilder<T> { 127 abstract class LinkBuilder<T> {
126 factory LinkBuilder() = LinkBuilderImplementation; 128 factory LinkBuilder() = LinkBuilderImplementation;
127 129
128 /** 130 /// Prepends all elements added to the builder to [tail]. The resulting list
129 * Prepends all elements added to the builder to [tail]. The resulting list is 131 /// is returned and the builder is cleared.
130 * returned and the builder is cleared.
131 */
132 Link<T> toLink([Link<T> tail = const Link()]); 132 Link<T> toLink([Link<T> tail = const Link()]);
133 133
134 /// Creates a new fixed length containing all added elements. The
135 /// resulting list is returned and the builder is cleared.
134 List<T> toList(); 136 List<T> toList();
135 137
138 /// Adds the element [t] to the end of the list being built.
136 Link<T> addLast(T t); 139 Link<T> addLast(T t);
137 140
141 /// Returns the first element in the list being built.
142 T get first;
143
144 /// Returns the number of elements in the list being built.
138 final int length; 145 final int length;
146
147 /// Returns `true` if the list being built is empty.
139 final bool isEmpty; 148 final bool isEmpty;
149
150 /// Removes all added elements and resets the builder.
151 void clear();
140 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698