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

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

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:compiler/compiler_new.dart' as api; 10 import 'package:compiler/compiler_new.dart' as api;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 startResolution(); 146 startResolution();
147 // We need to make sure the Object class is resolved. When registering a 147 // We need to make sure the Object class is resolved. When registering a
148 // dynamic invocation the ArgumentTypesRegistry eventually iterates over 148 // dynamic invocation the ArgumentTypesRegistry eventually iterates over
149 // the interfaces of the Object class which would be 'null' if the class 149 // the interfaces of the Object class which would be 'null' if the class
150 // wasn't resolved. 150 // wasn't resolved.
151 ClassElement objectClass = resolution.commonElements.objectClass; 151 ClassElement objectClass = resolution.commonElements.objectClass;
152 objectClass.ensureResolved(resolution); 152 objectClass.ensureResolved(resolution);
153 }).then((_) => uri); 153 }).then((_) => uri);
154 } 154 }
155 155
156 Future run(Uri uri, [String mainSource = ""]) { 156 Future<bool> run(Uri uri, [String mainSource = ""]) {
157 return init(mainSource).then((Uri mainUri) { 157 return init(mainSource).then((Uri mainUri) {
158 return super.run(uri == null ? mainUri : uri); 158 return super.run(uri == null ? mainUri : uri);
159 }).then((result) { 159 }).then((result) {
160 if (expectedErrors != null && 160 if (expectedErrors != null &&
161 expectedErrors != diagnosticCollector.errors.length) { 161 expectedErrors != diagnosticCollector.errors.length) {
162 throw "unexpected error during compilation " 162 throw "unexpected error during compilation "
163 "${diagnosticCollector.errors}"; 163 "${diagnosticCollector.errors}";
164 } else if (expectedWarnings != null && 164 } else if (expectedWarnings != null &&
165 expectedWarnings != diagnosticCollector.warnings.length) { 165 expectedWarnings != diagnosticCollector.warnings.length) {
166 throw "unexpected warnings during compilation " 166 throw "unexpected warnings during compilation "
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 283 }
284 284
285 /// Create a new [MockCompiler] and apply it asynchronously to [f]. 285 /// Create a new [MockCompiler] and apply it asynchronously to [f].
286 static Future create(f(MockCompiler compiler)) { 286 static Future create(f(MockCompiler compiler)) {
287 MockCompiler compiler = new MockCompiler.internal(); 287 MockCompiler compiler = new MockCompiler.internal();
288 return compiler.init().then((_) => f(compiler)); 288 return compiler.init().then((_) => f(compiler));
289 } 289 }
290 } 290 }
291 291
292 class MockResolvedUriTranslator implements ResolvedUriTranslator { 292 class MockResolvedUriTranslator implements ResolvedUriTranslator {
293 static final _emptySet = new Set(); 293 static final dynamic _emptySet = new Set();
294 294
295 Uri translate(LibraryElement importingLibrary, Uri resolvedUri, 295 Uri translate(LibraryElement importingLibrary, Uri resolvedUri,
296 Spannable spannable) => 296 Spannable spannable) =>
297 resolvedUri; 297 resolvedUri;
298 Set<Uri> get disallowedLibraryUris => _emptySet; 298 Set<Uri> get disallowedLibraryUris => _emptySet;
299 bool get mockableLibraryUsed => false; 299 bool get mockableLibraryUsed => false;
300 Map<String, Uri> get sdkLibraries => const <String, Uri>{}; 300 Map<String, Uri> get sdkLibraries => const <String, Uri>{};
301 } 301 }
302 302
303 class CollectingTreeElements extends TreeElementMapping { 303 class CollectingTreeElements extends TreeElementMapping {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 trustTypeAnnotations: trustTypeAnnotations, 394 trustTypeAnnotations: trustTypeAnnotations,
395 enableTypeAssertions: enableTypeAssertions, 395 enableTypeAssertions: enableTypeAssertions,
396 enableUserAssertions: enableUserAssertions, 396 enableUserAssertions: enableUserAssertions,
397 expectedErrors: expectedErrors, 397 expectedErrors: expectedErrors,
398 expectedWarnings: expectedWarnings, 398 expectedWarnings: expectedWarnings,
399 outputProvider: outputProvider); 399 outputProvider: outputProvider);
400 compiler.registerSource(uri, code); 400 compiler.registerSource(uri, code);
401 compiler.diagnosticHandler = createHandler(compiler, code); 401 compiler.diagnosticHandler = createHandler(compiler, code);
402 return compiler; 402 return compiler;
403 } 403 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mixin_typevariable_test.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698