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

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

Issue 2595493002: Merge CoreTypes and CoreClasses into CommonElements. (Closed)
Patch Set: Updated cf. comment Created 4 years 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.dart' as api; 10 import 'package:compiler/compiler.dart' as api;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 /// Initialize the mock compiler with an empty main library. 141 /// Initialize the mock compiler with an empty main library.
142 Future<Uri> init([String mainSource = ""]) { 142 Future<Uri> init([String mainSource = ""]) {
143 Uri uri = new Uri(scheme: "mock"); 143 Uri uri = new Uri(scheme: "mock");
144 registerSource(uri, mainSource); 144 registerSource(uri, mainSource);
145 return libraryLoader.loadLibrary(uri).then((LibraryElement library) { 145 return libraryLoader.loadLibrary(uri).then((LibraryElement library) {
146 mainApp = library; 146 mainApp = library;
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 coreClasses.objectClass.ensureResolved(resolution); 151 commonElements.objectClass.ensureResolved(resolution);
152 }).then((_) => uri); 152 }).then((_) => uri);
153 } 153 }
154 154
155 Future run(Uri uri, [String mainSource = ""]) { 155 Future run(Uri uri, [String mainSource = ""]) {
156 return init(mainSource).then((Uri mainUri) { 156 return init(mainSource).then((Uri mainUri) {
157 return super.run(uri == null ? mainUri : uri); 157 return super.run(uri == null ? mainUri : uri);
158 }).then((result) { 158 }).then((result) {
159 if (expectedErrors != null && 159 if (expectedErrors != null &&
160 expectedErrors != diagnosticCollector.errors.length) { 160 expectedErrors != diagnosticCollector.errors.length) {
161 throw "unexpected error during compilation " 161 throw "unexpected error during compilation "
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 trustTypeAnnotations: trustTypeAnnotations, 390 trustTypeAnnotations: trustTypeAnnotations,
391 enableTypeAssertions: enableTypeAssertions, 391 enableTypeAssertions: enableTypeAssertions,
392 enableUserAssertions: enableUserAssertions, 392 enableUserAssertions: enableUserAssertions,
393 expectedErrors: expectedErrors, 393 expectedErrors: expectedErrors,
394 expectedWarnings: expectedWarnings, 394 expectedWarnings: expectedWarnings,
395 outputProvider: outputProvider); 395 outputProvider: outputProvider);
396 compiler.registerSource(uri, code); 396 compiler.registerSource(uri, code);
397 compiler.diagnosticHandler = createHandler(compiler, code); 397 compiler.diagnosticHandler = createHandler(compiler, code);
398 return compiler; 398 return compiler;
399 } 399 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mirrors_used_test.dart ('k') | tests/compiler/dart2js/related_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698