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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/link.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 org_dartlang_compiler_util; 5 part of org_dartlang_compiler_util;
6 6
7 class Link<T> extends Iterable<T> { 7 class Link<T> extends Iterable<T> {
8 T get head => null; 8 T get head => null;
9 Link<T> get tail => null; 9 Link<T> get tail => null;
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 bool get isEmpty => true; 43 bool get isEmpty => true;
44 44
45 Link<T> reverse() => this; 45 Link<T> reverse() => this;
46 46
47 Link<T> reversePrependAll(Link<T> from) { 47 Link<T> reversePrependAll(Link<T> from) {
48 if (from.isEmpty) return this; 48 if (from.isEmpty) return this;
49 return this.prepend(from.head).reversePrependAll(from.tail); 49 return this.prepend(from.head).reversePrependAll(from.tail);
50 } 50 }
51 51
52 Link<T> skip(int n) {
53 if (n == 0) return this;
54 throw new RangeError('Index $n out of range');
55 }
56
52 void forEach(void f(T element)) {} 57 void forEach(void f(T element)) {}
53 58
54 bool operator ==(other) { 59 bool operator ==(other) {
55 if (other is !Link<T>) return false; 60 if (other is !Link<T>) return false;
56 return other.isEmpty; 61 return other.isEmpty;
57 } 62 }
58 63
59 String toString() => "[]"; 64 String toString() => "[]";
60 65
61 get length { 66 get length {
62 throw new UnsupportedError('get:length'); 67 throw new UnsupportedError('get:length');
63 } 68 }
64 } 69 }
65 70
66 abstract class LinkBuilder<T> { 71 abstract class LinkBuilder<T> {
67 factory LinkBuilder() = LinkBuilderImplementation; 72 factory LinkBuilder() = LinkBuilderImplementation;
68 73
69 Link<T> toLink(); 74 Link<T> toLink();
70 void addLast(T t); 75 void addLast(T t);
71 76
72 final int length; 77 final int length;
73 final bool isEmpty; 78 final bool isEmpty;
74 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698