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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/link_implementation.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 7 years, 6 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 | Annotate | Revision Log
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 util_implementation; 5 part of util_implementation;
6 6
7 class LinkIterator<T> implements Iterator<T> { 7 class LinkIterator<T> implements Iterator<T> {
8 T _current; 8 T _current;
9 Link<T> _link; 9 Link<T> _link;
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 int slowLength() => 1 + tail.slowLength(); 103 int slowLength() => 1 + tail.slowLength();
104 } 104 }
105 105
106 class LinkBuilderImplementation<T> implements LinkBuilder<T> { 106 class LinkBuilderImplementation<T> implements LinkBuilder<T> {
107 LinkEntry<T> head = null; 107 LinkEntry<T> head = null;
108 LinkEntry<T> lastLink = null; 108 LinkEntry<T> lastLink = null;
109 int length = 0; 109 int length = 0;
110 110
111 LinkBuilderImplementation(); 111 LinkBuilderImplementation();
112 112
113 Link<T> toLink() { 113 Link<T> toLink([Link<T> tail = const Link()]) {
114 if (head == null) return const Link(); 114 if (head == null) return tail;
115 lastLink.tail = const Link(); 115 lastLink.tail = tail;
116 Link<T> link = head; 116 Link<T> link = head;
117 lastLink = null; 117 lastLink = null;
118 head = null; 118 head = null;
119 return link; 119 return link;
120 } 120 }
121 121
122 void addLast(T t) { 122 void addLast(T t) {
123 length++; 123 length++;
124 LinkEntry<T> entry = new LinkEntry<T>(t, null); 124 LinkEntry<T> entry = new LinkEntry<T>(t, null);
125 if (head == null) { 125 if (head == null) {
126 head = entry; 126 head = entry;
127 } else { 127 } else {
128 lastLink.tail = entry; 128 lastLink.tail = entry;
129 } 129 }
130 lastLink = entry; 130 lastLink = entry;
131 } 131 }
132 132
133 bool get isEmpty => length == 0; 133 bool get isEmpty => length == 0;
134 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698