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

Unified Diff: tests/compiler/dart2js/codegen_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
« no previous file with comments | « tests/compiler/dart2js/closure_codegen_test.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/codegen_helper.dart
diff --git a/tests/compiler/dart2js/codegen_helper.dart b/tests/compiler/dart2js/codegen_helper.dart
index 4e8d4988587b01ef18a1e6cc1800bed2a570770a..1993ec54b07a11a68bb3c8f2f70b4b56d14f3412 100644
--- a/tests/compiler/dart2js/codegen_helper.dart
+++ b/tests/compiler/dart2js/codegen_helper.dart
@@ -2,19 +2,20 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:async';
import 'package:expect/expect.dart';
import 'memory_source_file_helper.dart';
import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"
show SourceString;
-Map<String, String> generate(String code, [List<String> options = const []]) {
+Future<Map<String, String>> generate(String code,
+ [List<String> options = const []]) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');
- MemorySourceFileProvider.MEMORY_SOURCE_FILES = { 'main.dart': code };
- var provider = new MemorySourceFileProvider();
+ var provider = new MemorySourceFileProvider({ 'main.dart': code });
var handler = new FormattingDiagnosticHandler(provider);
Compiler compiler = new Compiler(provider.readStringFromUri,
@@ -24,13 +25,15 @@ Map<String, String> generate(String code, [List<String> options = const []]) {
packageRoot,
options);
Uri uri = Uri.parse('memory:main.dart');
- Expect.isTrue(compiler.run(uri));
- Map<String, String> result = new Map<String, String>();
- for (var element in compiler.backend.generatedCode.keys) {
- if (element.getCompilationUnit().script.uri != uri) continue;
- var name = element.name.slowToString();
- var code = compiler.backend.assembleCode(element);
- result[name] = code;
- }
- return result;
+ return compiler.run(uri).then((success) {
+ Expect.isTrue(success);
+ Map<String, String> result = new Map<String, String>();
+ for (var element in compiler.backend.generatedCode.keys) {
+ if (element.getCompilationUnit().script.uri != uri) continue;
+ var name = element.name.slowToString();
+ var code = compiler.backend.assembleCode(element);
+ result[name] = code;
+ }
+ return result;
+ });
}
« no previous file with comments | « tests/compiler/dart2js/closure_codegen_test.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698