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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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) 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 '../../../sdk/lib/_internal/compiler/compiler.dart' as api; 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 /** 137 /**
138 * Used internally to create a library from a source text. The created library 138 * Used internally to create a library from a source text. The created library
139 * is fixed to export its top-level declarations. 139 * is fixed to export its top-level declarations.
140 */ 140 */
141 LibraryElement createLibrary(String name, String source) { 141 LibraryElement createLibrary(String name, String source) {
142 Uri uri = new Uri.fromComponents(scheme: "source", path: name); 142 Uri uri = new Uri.fromComponents(scheme: "source", path: name);
143 var script = new Script(uri, new MockFile(source)); 143 var script = new Script(uri, new MockFile(source));
144 var library = new LibraryElement(script); 144 var library = new LibraryElement(script);
145 parseScript(source, library); 145 parseScript(source, library);
146 library.setExports(library.localScope.values); 146 library.setExports(library.localScope.values.toList());
147 return library; 147 return library;
148 } 148 }
149 149
150 void reportWarning(Node node, var message) { 150 void reportWarning(Node node, var message) {
151 warnings.add(new WarningMessage(node, message.message)); 151 warnings.add(new WarningMessage(node, message.message));
152 } 152 }
153 153
154 void reportError(Node node, var message) { 154 void reportError(Node node, var message) {
155 if (message is String && message.startsWith("no library name found in")) { 155 if (message is String && message.startsWith("no library name found in")) {
156 // TODO(ahe): Fix the MockCompiler to not have this problem. 156 // TODO(ahe): Fix the MockCompiler to not have this problem.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 Script readScript(Uri uri, [ScriptTag node]) { 231 Script readScript(Uri uri, [ScriptTag node]) {
232 SourceFile sourceFile = sourceFiles[uri.toString()]; 232 SourceFile sourceFile = sourceFiles[uri.toString()];
233 if (sourceFile == null) throw new ArgumentError(uri); 233 if (sourceFile == null) throw new ArgumentError(uri);
234 return new Script(uri, sourceFile); 234 return new Script(uri, sourceFile);
235 } 235 }
236 } 236 }
237 237
238 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { 238 void compareWarningKinds(String text, expectedWarnings, foundWarnings) {
239 var fail = (message) => Expect.fail('$text: $message'); 239 var fail = (message) => Expect.fail('$text: $message');
240 Iterator<MessageKind> expected = expectedWarnings.iterator(); 240 HasNextIterator<MessageKind> expected =
241 Iterator<WarningMessage> found = foundWarnings.iterator(); 241 new HasNextIterator(expectedWarnings.iterator);
242 HasNextIterator<WarningMessage> found =
243 new HasNextIterator(foundWarnings.iterator);
242 while (expected.hasNext && found.hasNext) { 244 while (expected.hasNext && found.hasNext) {
243 Expect.equals(expected.next(), found.next().message.kind); 245 Expect.equals(expected.next(), found.next().message.kind);
244 } 246 }
245 if (expected.hasNext) { 247 if (expected.hasNext) {
246 do { 248 do {
247 print('Expected warning "${expected.next()}" did not occur'); 249 print('Expected warning "${expected.next()}" did not occur');
248 } while (expected.hasNext); 250 } while (expected.hasNext);
249 fail('Too few warnings'); 251 fail('Too few warnings');
250 } 252 }
251 if (found.hasNext) { 253 if (found.hasNext) {
(...skipping 28 matching lines...) Expand all
280 operator []=(Node node, Element element) { 282 operator []=(Node node, Element element) {
281 map[node] = element; 283 map[node] = element;
282 } 284 }
283 285
284 operator [](Node node) => map[node]; 286 operator [](Node node) => map[node];
285 287
286 void remove(Node node) { 288 void remove(Node node) {
287 map.remove(node); 289 map.remove(node);
288 } 290 }
289 } 291 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/identity_test.dart ('k') | tests/compiler/dart2js/no_duplicate_constructor_body2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698