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

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

Issue 1146943002: Change Link to List in FunctionSignature. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 result = new List(); 49 result = new List();
50 result.length = slowLength(); 50 result.length = slowLength();
51 } 51 }
52 int i = 0; 52 int i = 0;
53 for (Link<T> link = this; !link.isEmpty; link = link.tail) { 53 for (Link<T> link = this; !link.isEmpty; link = link.tail) {
54 result[i++] = fn(link.head); 54 result[i++] = fn(link.head);
55 } 55 }
56 return result; 56 return result;
57 } 57 }
58 58
59 /// Invokes `fn` for every item in the linked list and returns the results
60 /// in a [Set].
61 Set mapToSet(dynamic fn(T item)) {
62 Set result = new Set();
63 for (Link<T> link = this; !link.isEmpty; link = link.tail) {
64 result.add(fn(link.head));
65 }
66 return result;
67 }
68
69 bool get isEmpty => true; 59 bool get isEmpty => true;
70 60
71 Link<T> reverse() => this; 61 Link<T> reverse() => this;
72 62
73 Link<T> reversePrependAll(Link<T> from) { 63 Link<T> reversePrependAll(Link<T> from) {
74 if (from.isEmpty) return this; 64 if (from.isEmpty) return this;
75 return this.prepend(from.head).reversePrependAll(from.tail); 65 return this.prepend(from.head).reversePrependAll(from.tail);
76 } 66 }
77 67
78 Link<T> skip(int n) { 68 Link<T> skip(int n) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 */ 130 */
141 Link<T> toLink([Link<T> tail = const Link()]); 131 Link<T> toLink([Link<T> tail = const Link()]);
142 132
143 List<T> toList(); 133 List<T> toList();
144 134
145 void addLast(T t); 135 void addLast(T t);
146 136
147 final int length; 137 final int length;
148 final bool isEmpty; 138 final bool isEmpty;
149 } 139 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/universe.dart ('k') | tests/compiler/dart2js/concrete_type_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698