Chromium Code Reviews| Index: tests/compiler/dart2js/kernel/helper.dart |
| diff --git a/tests/compiler/dart2js/kernel/helper.dart b/tests/compiler/dart2js/kernel/helper.dart |
| index d7d4b11f6ee1e10d4ad25ac2cd351b43027c5e81..4bb2631be977a8a900711e133f5ae9e85ac98a33 100644 |
| --- a/tests/compiler/dart2js/kernel/helper.dart |
| +++ b/tests/compiler/dart2js/kernel/helper.dart |
| @@ -17,7 +17,8 @@ Future<String> compile(String code, |
| {String entry: 'main', |
| bool useKernel: true, |
| bool disableTypeInference: true, |
| - List<String> extraOptions: const <String>[]}) async { |
| + List<String> extraOptions: const <String>[], |
| + Element checkElement(Compiler compiler)}) async { |
|
Siggi Cherem (dart-lang)
2016/11/14 18:22:25
maybe we can merge checkElement & entry, they seem
Harry Terkelsen
2016/11/14 23:23:40
Done.
|
| List<String> options = <String>[ |
| Flags.disableInlining, |
| ]; |
| @@ -32,7 +33,12 @@ Future<String> compile(String code, |
| memorySourceFiles: {'main.dart': code}, options: options); |
| expect(result.isSuccess, isTrue); |
| Compiler compiler = result.compiler; |
| - Element element = compiler.mainApp.find(entry); |
| + Element element; |
| + if (checkElement == null) { |
| + element = compiler.mainApp.find(entry); |
| + } else { |
| + element = checkElement(compiler); |
| + } |
| js.JavaScriptBackend backend = compiler.backend; |
| return backend.getGeneratedCode(element); |
| } |
| @@ -40,16 +46,19 @@ Future<String> compile(String code, |
| Future check(String code, |
| {String entry: 'main', |
| bool disableTypeInference: true, |
| - List<String> extraOptions: const <String>[]}) async { |
| + List<String> extraOptions: const <String>[], |
| + Element checkElement(Compiler compiler)}) async { |
| var original = await compile(code, |
| entry: entry, |
| useKernel: false, |
| disableTypeInference: disableTypeInference, |
| - extraOptions: extraOptions); |
| + extraOptions: extraOptions, |
| + checkElement: checkElement); |
| var kernel = await compile(code, |
| entry: entry, |
| useKernel: true, |
| disableTypeInference: disableTypeInference, |
| - extraOptions: extraOptions); |
| + extraOptions: extraOptions, |
| + checkElement: checkElement); |
| expect(kernel, original); |
| } |