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

Side by Side Diff: frog/leg/util/link_implementation.dart

Issue 8681027: Fix bug 578 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: prereviewed Created 9 years, 1 month 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
« no previous file with comments | « frog/lang.dart ('k') | frog/library.dart » ('j') | 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 // TODO(ahe): This class should not be generic. 5 // TODO(ahe): This class should not be generic.
6 class LinkFactory { 6 class LinkFactory {
7 factory Link<T>(head, [Link tail]) { 7 factory Link<T>(T head, [Link<T> tail]) {
8 if (tail === null) { 8 if (tail === null) {
9 // TODO(ahe): Remove below comment about Frog bug when it is fixed. 9 tail = new LinkTail<T>();
10 tail = new LinkTail<T>(); // Frog bug: T is in scope.
11 } 10 }
12 // TODO(ahe): Remove below comment about Frog bug when it is fixed. 11 return new LinkEntry<T>(head, tail);
13 return new LinkEntry<T>(head, tail); // Frog bug: T is in scope.
14 } 12 }
15 13
16 factory Link<T>.fromList(List list) { 14 factory Link<T>.fromList(List<T> list) {
17 switch (list.length) { 15 switch (list.length) {
18 case 0: 16 case 0:
19 return new LinkTail<T>(); 17 return new LinkTail<T>();
20 case 1: 18 case 1:
21 return new Link<T>(list[0]); 19 return new Link<T>(list[0]);
22 case 2: 20 case 2:
23 return new Link<T>(list[0], new Link<T>(list[1])); 21 return new Link<T>(list[0], new Link<T>(list[1]));
24 case 3: 22 case 3:
25 return new Link<T>(list[0], new Link<T>(list[1], new Link<T>(list[2]))); 23 return new Link<T>(list[0], new Link<T>(list[1], new Link<T>(list[2])));
26 } 24 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void addLast(T t) { 120 void addLast(T t) {
123 LinkEntry<T> entry = new LinkEntry<T>(t, null); 121 LinkEntry<T> entry = new LinkEntry<T>(t, null);
124 if (head === null) { 122 if (head === null) {
125 head = entry; 123 head = entry;
126 } else { 124 } else {
127 lastLink.realTail = entry; 125 lastLink.realTail = entry;
128 } 126 }
129 lastLink = entry; 127 lastLink = entry;
130 } 128 }
131 } 129 }
OLDNEW
« no previous file with comments | « frog/lang.dart ('k') | frog/library.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698