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; |
+ }); |
} |