Index: tests/compiler/dart2js/compiler_helper.dart |
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart |
index e0a69f1790928115e4441d0de0fedba56e088e89..c7e1e92a26e5c2a9992a16ffebe0aca7e4ff8aa1 100644 |
--- a/tests/compiler/dart2js/compiler_helper.dart |
+++ b/tests/compiler/dart2js/compiler_helper.dart |
@@ -43,7 +43,8 @@ import 'memory_compiler.dart' hide compilerFor; |
import 'output_collector.dart'; |
export 'output_collector.dart'; |
-/// Compile [code] and returns the code for [entry]. |
+/// Compile [code] and returns either the code for [entry] or, if [returnAll] is |
+/// true, the code for the entire program. |
/// |
/// If [check] is provided, it is executed on the code for [entry] before |
/// returning. If [useMock] is `true` the [MockCompiler] is used for |
@@ -55,7 +56,9 @@ Future<String> compile(String code, |
bool analyzeAll: false, |
bool disableInlining: true, |
bool useMock: false, |
- void check(String generated)}) async { |
+ void check(String generatedEntry), |
+ bool returnAll: false}) async { |
+ OuputCollector outputCollector = returnAll ? new OutputCollector() : null; |
if (useMock) { |
// TODO(johnniwinther): Remove this when no longer needed by |
// `arithmetic_simplication_test.dart`. |
@@ -65,7 +68,8 @@ Future<String> compile(String code, |
// compiling a method. |
disableTypeInference: true, |
enableMinification: minify, |
- disableInlining: disableInlining); |
+ disableInlining: disableInlining, |
+ outputProvider: outputCollector); |
await compiler.init(); |
compiler.parseScript(code); |
lego.Element element = compiler.mainApp.find(entry); |
@@ -89,7 +93,7 @@ Future<String> compile(String code, |
if (check != null) { |
check(generated); |
} |
- return generated; |
+ return returnAll ? outputCollector.getOutput('', 'js') : generated; |
} else { |
List<String> options = <String>[ |
Flags.disableTypeInference]; |
@@ -113,6 +117,7 @@ Future<String> compile(String code, |
CompilationResult result = await runCompiler( |
memorySourceFiles: source, |
options: options, |
+ outputProvider: outputCollector, |
beforeRun: (compiler) { |
if (disableInlining) { |
compiler.disableInlining = true; |
@@ -126,7 +131,7 @@ Future<String> compile(String code, |
if (check != null) { |
check(generated); |
} |
- return generated; |
+ return returnAll ? outputCollector.getOutput('', 'js') : generated; |
} |
} |