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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/missing_file_test.dart ('k') | tests/compiler/dart2js/no_constructor_body_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index c30295ee4b4ef304951b7aacf591007866612607..26a401a934de8bf4a96efe02c8ef0fe386793636 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -5,6 +5,7 @@
library mock_compiler;
import "package:expect/expect.dart";
+import 'dart:async';
import 'dart:collection';
import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
@@ -238,13 +239,18 @@ class MockCompiler extends Compiler {
analyzeOnly: analyzeOnly,
emitJavaScript: emitJavaScript,
preserveComments: preserveComments) {
- coreLibrary = createLibrary("core", coreSource);
+ coreLibrary = deprecatedFutureValue(createLibrary("core", coreSource));
+
// We need to set the assert method to avoid calls with a 'null'
// target being interpreted as a call to assert.
- jsHelperLibrary = createLibrary("helper", helperSource);
- foreignLibrary = createLibrary("foreign", FOREIGN_LIBRARY);
- interceptorsLibrary = createLibrary("interceptors", interceptorsSource);
- isolateHelperLibrary = createLibrary("isolate_helper", isolateHelperSource);
+ jsHelperLibrary = deprecatedFutureValue(
+ createLibrary("helper", helperSource));
+ foreignLibrary = deprecatedFutureValue(
+ createLibrary("foreign", FOREIGN_LIBRARY));
+ interceptorsLibrary = deprecatedFutureValue(
+ createLibrary("interceptors", interceptorsSource));
+ isolateHelperLibrary = deprecatedFutureValue(
+ createLibrary("isolate_helper", isolateHelperSource));
// Set up the library imports.
importHelperLibrary(coreLibrary);
@@ -282,7 +288,7 @@ class MockCompiler extends Compiler {
* Used internally to create a library from a source text. The created library
* is fixed to export its top-level declarations.
*/
- LibraryElement createLibrary(String name, String source) {
+ Future<LibraryElement> createLibrary(String name, String source) {
Uri uri = new Uri(scheme: "dart", path: name);
var script = new Script(uri, new MockFile(source));
var library = new LibraryElementX(script);
@@ -291,7 +297,7 @@ class MockCompiler extends Compiler {
library.setExports(library.localScope.values.toList());
registerSource(uri, source);
libraries.putIfAbsent(uri.toString(), () => library);
- return library;
+ return new Future.value(library);
}
void reportWarning(Node node, var message) {
@@ -377,12 +383,14 @@ class MockCompiler extends Compiler {
parseUnit(text, this, library, registerSource);
}
- void scanBuiltinLibraries() {
+ Future scanBuiltinLibraries() {
// Do nothing. The mock core library is already handled in the constructor.
+ return new Future.value();
}
- LibraryElement scanBuiltinLibrary(String name) {
+ Future<LibraryElement> scanBuiltinLibrary(String name) {
// Do nothing. The mock core library is already handled in the constructor.
+ return new Future.value();
}
Uri translateResolvedUri(LibraryElement importingLibrary,
@@ -391,10 +399,10 @@ class MockCompiler extends Compiler {
// The mock library doesn't need any patches.
Uri resolvePatchUri(String dartLibraryName) => null;
- Script readScript(Uri uri, [Node node]) {
+ Future<Script> readScript(Uri uri, [Element element, Node node]) {
SourceFile sourceFile = sourceFiles[uri.toString()];
if (sourceFile == null) throw new ArgumentError(uri);
- return new Script(uri, sourceFile);
+ return new Future.value(new Script(uri, sourceFile));
}
Element lookupElementIn(ScopeContainerElement container, name) {
« no previous file with comments | « tests/compiler/dart2js/missing_file_test.dart ('k') | tests/compiler/dart2js/no_constructor_body_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698