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

Side by Side Diff: pkg/front_end/lib/src/fasta/util/link_implementation.dart

Issue 2723113002: Consolidate analyzer dependencies. (Closed)
Patch Set: Remove new dependency on AsyncMarker. Created 3 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
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 library fasta.util.link_implementation; 5 library fasta.util.link_implementation;
6 6
7 import 'dart:collection' show IterableBase; 7 import 'dart:collection' show IterableBase;
8 8
9 import 'link.dart' show Link, LinkBuilder; 9 import 'link.dart' show Link, LinkBuilder;
10 10
11 class LinkIterator<T> implements Iterator<T> { 11 class LinkIterator<T> implements Iterator<T> {
12 T _current; 12 T _current;
13 Link<T> _link; 13 Link<T> _link;
14 14
15 LinkIterator(Link<T> this._link); 15 LinkIterator(this._link);
16 16
17 T get current => _current; 17 T get current => _current;
18 18
19 bool moveNext() { 19 bool moveNext() {
20 if (_link.isEmpty) { 20 if (_link.isEmpty) {
21 _current = null; 21 _current = null;
22 return false; 22 return false;
23 } 23 }
24 _current = _link.head; 24 _current = _link.head;
25 _link = _link.tail; 25 _link = _link.tail;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 Iterator<T> get iterator { 58 Iterator<T> get iterator {
59 return new MappedLinkIterator<S, T>(_link, _transformation); 59 return new MappedLinkIterator<S, T>(_link, _transformation);
60 } 60 }
61 } 61 }
62 62
63 class LinkEntry<T> extends Link<T> { 63 class LinkEntry<T> extends Link<T> {
64 final T head; 64 final T head;
65 Link<T> tail; 65 Link<T> tail;
66 66
67 LinkEntry(T this.head, [Link<T> tail]) 67 LinkEntry(this.head, [Link<T> tail])
68 : this.tail = ((tail == null) ? const Link() : tail); 68 : this.tail = ((tail == null) ? const Link() : tail);
69 69
70 Link<T> prepend(T element) { 70 Link<T> prepend(T element) {
71 // TODO(ahe): Use new Link<T>, but this cost 8% performance on VM. 71 // TODO(ahe): Use new Link<T>, but this cost 8% performance on VM.
72 return new LinkEntry<T>(element, this); 72 return new LinkEntry<T>(element, this);
73 } 73 }
74 74
75 void printOn(StringBuffer buffer, [separatedBy]) { 75 void printOn(StringBuffer buffer, [separatedBy]) {
76 buffer.write(head); 76 buffer.write(head);
77 if (separatedBy == null) separatedBy = ''; 77 if (separatedBy == null) separatedBy = '';
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 throw new StateError("no elements"); 214 throw new StateError("no elements");
215 } 215 }
216 216
217 void clear() { 217 void clear() {
218 head = null; 218 head = null;
219 lastLink = null; 219 lastLink = null;
220 length = 0; 220 length = 0;
221 } 221 }
222 } 222 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/suite.dart ('k') | pkg/front_end/test/subpackage_relationships_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698