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

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

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 years, 2 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 'dart:uri'; 7 import 'dart:uri';
8 8
9 import '../../../lib/compiler/compiler.dart' as api; 9 import '../../../lib/compiler/compiler.dart' as api;
10 import '../../../lib/compiler/implementation/dart2jslib.dart' hide TreeElementMa pping; 10 import '../../../lib/compiler/implementation/dart2jslib.dart' hide TreeElementMa pping;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 SourceFile sourceFile = sourceFiles[uri.toString()]; 195 SourceFile sourceFile = sourceFiles[uri.toString()];
196 if (sourceFile === null) throw new ArgumentError(uri); 196 if (sourceFile === null) throw new ArgumentError(uri);
197 return new Script(uri, sourceFile); 197 return new Script(uri, sourceFile);
198 } 198 }
199 } 199 }
200 200
201 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { 201 void compareWarningKinds(String text, expectedWarnings, foundWarnings) {
202 var fail = (message) => Expect.fail('$text: $message'); 202 var fail = (message) => Expect.fail('$text: $message');
203 Iterator<MessageKind> expected = expectedWarnings.iterator(); 203 Iterator<MessageKind> expected = expectedWarnings.iterator();
204 Iterator<WarningMessage> found = foundWarnings.iterator(); 204 Iterator<WarningMessage> found = foundWarnings.iterator();
205 while (expected.hasNext() && found.hasNext()) { 205 while (expected.hasNext && found.hasNext) {
206 Expect.equals(expected.next(), found.next().message.kind); 206 Expect.equals(expected.next(), found.next().message.kind);
207 } 207 }
208 if (expected.hasNext()) { 208 if (expected.hasNext) {
209 do { 209 do {
210 print('Expected warning "${expected.next()}" did not occur'); 210 print('Expected warning "${expected.next()}" did not occur');
211 } while (expected.hasNext()); 211 } while (expected.hasNext);
212 fail('Too few warnings'); 212 fail('Too few warnings');
213 } 213 }
214 if (found.hasNext()) { 214 if (found.hasNext) {
215 do { 215 do {
216 print('Additional warning "${found.next()}"'); 216 print('Additional warning "${found.next()}"');
217 } while (found.hasNext()); 217 } while (found.hasNext);
218 fail('Too many warnings'); 218 fail('Too many warnings');
219 } 219 }
220 } 220 }
221 221
222 void importLibrary(LibraryElement target, LibraryElement imported, 222 void importLibrary(LibraryElement target, LibraryElement imported,
223 Compiler compiler) { 223 Compiler compiler) {
224 for (var element in imported.localMembers) { 224 for (var element in imported.localMembers) {
225 compiler.withCurrentElement(element, () { 225 compiler.withCurrentElement(element, () {
226 target.addToScope(element, compiler); 226 target.addToScope(element, compiler);
227 }); 227 });
228 } 228 }
229 } 229 }
230 230
231 LibraryElement mockLibrary(Compiler compiler, String source) { 231 LibraryElement mockLibrary(Compiler compiler, String source) {
232 Uri uri = new Uri.fromComponents(scheme: "source"); 232 Uri uri = new Uri.fromComponents(scheme: "source");
233 var library = new LibraryElement(new Script(uri, new MockFile(source))); 233 var library = new LibraryElement(new Script(uri, new MockFile(source)));
234 importLibrary(library, compiler.coreLibrary, compiler); 234 importLibrary(library, compiler.coreLibrary, compiler);
235 return library; 235 return library;
236 } 236 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/identity_test.dart ('k') | tests/compiler/dart2js/pretty_parameter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698