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: sdk/lib/_internal/compiler/implementation/util/link_implementation.dart

Issue 11778039: Report arity errors on user definable operators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments + Link test updated. Created 7 years, 11 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 Link<T> reversePrependAll(Link<T> from) { 63 Link<T> reversePrependAll(Link<T> from) {
64 Link<T> result; 64 Link<T> result;
65 for (result = this; !from.isEmpty; from = from.tail) { 65 for (result = this; !from.isEmpty; from = from.tail) {
66 result = result.prepend(from.head); 66 result = result.prepend(from.head);
67 } 67 }
68 return result; 68 return result;
69 } 69 }
70 70
71 Link<T> skip(int n) {
72 Link<T> link = this;
73 for (int i = 0 ; i < n ; i++) {
74 if (link.isEmpty) {
75 throw new RangeError('Index $n out of range');
76 }
77 link = link.tail;
78 }
79 return link;
80 }
71 81
72 bool get isEmpty => false; 82 bool get isEmpty => false;
73 83
74 List<T> toList() { 84 List<T> toList() {
75 List<T> list = new List<T>(); 85 List<T> list = new List<T>();
76 for (Link<T> link = this; !link.isEmpty; link = link.tail) { 86 for (Link<T> link = this; !link.isEmpty; link = link.tail) {
77 list.addLast(link.head); 87 list.addLast(link.head);
78 } 88 }
79 return list; 89 return list;
80 } 90 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (head == null) { 131 if (head == null) {
122 head = entry; 132 head = entry;
123 } else { 133 } else {
124 lastLink.tail = entry; 134 lastLink.tail = entry;
125 } 135 }
126 lastLink = entry; 136 lastLink = entry;
127 } 137 }
128 138
129 bool get isEmpty => length == 0; 139 bool get isEmpty => length == 0;
130 } 140 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/link.dart ('k') | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698