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

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

Issue 8952006: Fix factories in Frog to correspond to the new syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged, and update test status Created 9 years 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/leg/util/link.dart ('k') | frog/member.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 class LinkFactory<T> {
6 class LinkFactory { 6 factory Link(T head, [Link<T> tail]) {
7 factory Link<T>(T head, [Link<T> tail]) {
8 if (tail === null) { 7 if (tail === null) {
9 tail = new LinkTail<T>(); 8 tail = new LinkTail<T>();
10 } 9 }
11 return new LinkEntry<T>(head, tail); 10 return new LinkEntry<T>(head, tail);
12 } 11 }
13 12
14 factory Link<T>.fromList(List<T> list) { 13 factory Link.fromList(List<T> list) {
15 switch (list.length) { 14 switch (list.length) {
16 case 0: 15 case 0:
17 return new LinkTail<T>(); 16 return new LinkTail<T>();
18 case 1: 17 case 1:
19 return new Link<T>(list[0]); 18 return new Link<T>(list[0]);
20 case 2: 19 case 2:
21 return new Link<T>(list[0], new Link<T>(list[1])); 20 return new Link<T>(list[0], new Link<T>(list[1]));
22 case 3: 21 case 3:
23 return new Link<T>(list[0], new Link<T>(list[1], new Link<T>(list[2]))); 22 return new Link<T>(list[0], new Link<T>(list[1], new Link<T>(list[2])));
24 } 23 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void addLast(T t) { 122 void addLast(T t) {
124 LinkEntry<T> entry = new LinkEntry<T>(t, null); 123 LinkEntry<T> entry = new LinkEntry<T>(t, null);
125 if (head === null) { 124 if (head === null) {
126 head = entry; 125 head = entry;
127 } else { 126 } else {
128 lastLink.tail = entry; 127 lastLink.tail = entry;
129 } 128 }
130 lastLink = entry; 129 lastLink = entry;
131 } 130 }
132 } 131 }
OLDNEW
« no previous file with comments | « frog/leg/util/link.dart ('k') | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698