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

Side by Side Diff: dart/tests/compiler/dart2js/mock_compiler.dart

Issue 17588005: Warn about overriding operator== but not hashCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update comments (according to my dictionary whitelist is a word). Created 7 years, 5 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library mock_compiler; 5 library mock_compiler;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 const String FOREIGN_LIBRARY = r''' 90 const String FOREIGN_LIBRARY = r'''
91 dynamic JS(String typeDescription, String codeTemplate, 91 dynamic JS(String typeDescription, String codeTemplate,
92 [var arg0, var arg1, var arg2, var arg3, var arg4, var arg5, var arg6, 92 [var arg0, var arg1, var arg2, var arg3, var arg4, var arg5, var arg6,
93 var arg7, var arg8, var arg9, var arg10, var arg11]) {}'''; 93 var arg7, var arg8, var arg9, var arg10, var arg11]) {}''';
94 94
95 const String DEFAULT_INTERCEPTORSLIB = r''' 95 const String DEFAULT_INTERCEPTORSLIB = r'''
96 class Interceptor { 96 class Interceptor {
97 toString() {} 97 toString() {}
98 bool operator==(other) => identical(this, other); 98 bool operator==(other) => identical(this, other);
99 get hashCode => throw "Interceptor.hashCode not implemented.";
99 noSuchMethod(im) { throw im; } 100 noSuchMethod(im) { throw im; }
100 } 101 }
101 abstract class JSIndexable { 102 abstract class JSIndexable {
102 get length; 103 get length;
103 } 104 }
104 abstract class JSMutableIndexable extends JSIndexable {} 105 abstract class JSMutableIndexable extends JSIndexable {}
105 class JSArray extends Interceptor implements List, JSIndexable { 106 class JSArray extends Interceptor implements List, JSIndexable {
106 var length; 107 var length;
107 operator[](index) => this[index]; 108 operator[](index) => this[index];
108 operator[]=(index, value) {} 109 operator[]=(index, value) {}
(...skipping 21 matching lines...) Expand all
130 operator >>(other) => 42; 131 operator >>(other) => 42;
131 operator |(other) => 42; 132 operator |(other) => 42;
132 operator &(other) => 42; 133 operator &(other) => 42;
133 operator ^(other) => 42; 134 operator ^(other) => 42;
134 135
135 operator >(other) => true; 136 operator >(other) => true;
136 operator >=(other) => true; 137 operator >=(other) => true;
137 operator <(other) => true; 138 operator <(other) => true;
138 operator <=(other) => true; 139 operator <=(other) => true;
139 operator ==(other) => true; 140 operator ==(other) => true;
141 get hashCode => throw "JSNumber.hashCode not implemented.";
140 142
141 abs() => (this is JSInt) ? 42 : 42.0; 143 abs() => (this is JSInt) ? 42 : 42.0;
142 remainder(other) => (this is JSInt) ? 42 : 42.0; 144 remainder(other) => (this is JSInt) ? 42 : 42.0;
143 } 145 }
144 class JSInt extends JSNumber implements int { 146 class JSInt extends JSNumber implements int {
145 } 147 }
146 class JSDouble extends JSNumber implements double { 148 class JSDouble extends JSNumber implements double {
147 } 149 }
148 class JSNull extends Interceptor { 150 class JSNull extends Interceptor {
149 bool operator==(other) => identical(null, other); 151 bool operator==(other) => identical(null, other);
152 get hashCode => throw "JSNull.hashCode not implemented.";
150 } 153 }
151 class JSBool extends Interceptor implements bool { 154 class JSBool extends Interceptor implements bool {
152 } 155 }
153 class JSFunction extends Interceptor implements Function { 156 class JSFunction extends Interceptor implements Function {
154 } 157 }
155 class ObjectInterceptor { 158 class ObjectInterceptor {
156 } 159 }
157 getInterceptor(x) {} 160 getInterceptor(x) {}
158 getNativeInterceptor(x) {} 161 getNativeInterceptor(x) {}
159 var dispatchPropertyName; 162 var dispatchPropertyName;
160 getDispatchProperty(o) {} 163 getDispatchProperty(o) {}
161 initializeDispatchProperty(f,p,i) {} 164 initializeDispatchProperty(f,p,i) {}
162 initializeDispatchPropertyCSP(f,p,i) {} 165 initializeDispatchPropertyCSP(f,p,i) {}
163 '''; 166 ''';
164 167
165 const String DEFAULT_CORELIB = r''' 168 const String DEFAULT_CORELIB = r'''
166 print(var obj) {} 169 print(var obj) {}
167 abstract class num {} 170 abstract class num {}
168 abstract class int extends num { } 171 abstract class int extends num { }
169 abstract class double extends num { 172 abstract class double extends num {
170 static var NAN = 0; 173 static var NAN = 0;
171 static parse(s) {} 174 static parse(s) {}
172 } 175 }
173 class bool {} 176 class bool {}
174 class String implements Pattern {} 177 class String implements Pattern {}
175 class Object { 178 class Object {
176 operator ==(other) { return true; } 179 operator ==(other) { return true; }
180 get hashCode => throw "Object.hashCode not implemented.";
177 String toString() { return null; } 181 String toString() { return null; }
178 noSuchMethod(im) { throw im; } 182 noSuchMethod(im) { throw im; }
179 } 183 }
180 abstract class StackTrace {} 184 abstract class StackTrace {}
181 class Type {} 185 class Type {}
182 class Function {} 186 class Function {}
183 class List<E> { 187 class List<E> {
184 List([length]); 188 List([length]);
185 List.filled(length, element); 189 List.filled(length, element);
186 } 190 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 450 }
447 } 451 }
448 452
449 class MockDeferredLoadTask extends DeferredLoadTask { 453 class MockDeferredLoadTask extends DeferredLoadTask {
450 MockDeferredLoadTask(Compiler compiler) : super(compiler); 454 MockDeferredLoadTask(Compiler compiler) : super(compiler);
451 455
452 void registerMainApp(LibraryElement mainApp) { 456 void registerMainApp(LibraryElement mainApp) {
453 // Do nothing. 457 // Do nothing.
454 } 458 }
455 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698