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: Remove withCurrentElementAsync Created 7 years, 5 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
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 950a7e5ebbc2cb3eebb519ac4a7847a7ff739cd5..be1a712bda7e4b27754be8960f3d2fb19108dfec 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;
@@ -233,13 +234,18 @@ class MockCompiler extends Compiler {
analyzeAllFlag: analyzeAll,
analyzeOnly: analyzeOnly,
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);
@@ -277,7 +283,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);
@@ -286,7 +292,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) {
@@ -372,12 +378,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();
}
void importCoreLibrary(LibraryElement library) {
@@ -390,10 +398,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) {

Powered by Google App Engine
This is Rietveld 408576698