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

Unified Diff: tests/compiler/dart2js/compiler_helper.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
Index: tests/compiler/dart2js/compiler_helper.dart
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index d891603487e01db47187cad87ef31b7cd4dea5be..98aeb8a1ece3179d6140c249668fee56e31e7416 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -5,6 +5,7 @@
library compiler_helper;
+import 'dart:async';
import "package:expect/expect.dart";
import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
@@ -90,40 +91,42 @@ MockCompiler compilerFor(String code, Uri uri,
return compiler;
}
-String compileAll(String code, {String coreSource: DEFAULT_CORELIB}) {
+Future<String> compileAll(String code, {String coreSource: DEFAULT_CORELIB}) {
Uri uri = new Uri(scheme: 'source');
MockCompiler compiler = compilerFor(code, uri, coreSource: coreSource);
- compiler.runCompiler(uri);
- Expect.isFalse(compiler.compilationFailed,
- 'Unexpected compilation error');
- return compiler.assembledCode;
+ return compiler.runCompiler(uri).then((_) {
+ Expect.isFalse(compiler.compilationFailed,
+ 'Unexpected compilation error');
+ return compiler.assembledCode;
+ });
}
-dynamic compileAndCheck(String code,
- String name,
- check(MockCompiler compiler, lego.Element element)) {
+Future compileAndCheck(String code,
+ String name,
+ check(MockCompiler compiler, lego.Element element)) {
Uri uri = new Uri(scheme: 'source');
MockCompiler compiler = compilerFor(code, uri);
- compiler.runCompiler(uri);
- lego.Element element = findElement(compiler, name);
- return check(compiler, element);
+ return compiler.runCompiler(uri).then((_) {
+ lego.Element element = findElement(compiler, name);
+ return check(compiler, element);
+ });
}
-compileSources(Map<String, String> sources,
+Future compileSources(Map<String, String> sources,
check(MockCompiler compiler)) {
Uri base = new Uri(scheme: 'source');
Uri mainUri = base.resolve('main.dart');
String mainCode = sources['main.dart'];
Expect.isNotNull(mainCode, 'No source code found for "main.dart"');
MockCompiler compiler = compilerFor(mainCode, mainUri);
-
sources.forEach((String path, String code) {
if (path == 'main.dart') return;
compiler.registerSource(base.resolve(path), code);
});
- compiler.runCompiler(mainUri);
- return check(compiler);
+ return compiler.runCompiler(mainUri).then((_) {
+ return check(compiler);
+ });
}
lego.Element findElement(compiler, String name) {
« no previous file with comments | « tests/compiler/dart2js/codegen_helper.dart ('k') | tests/compiler/dart2js/concrete_type_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698