| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library test.kernel.closures.suite; | 5 library test.kernel.closures.suite; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:front_end/physical_file_system.dart'; | 9 import 'package:front_end/physical_file_system.dart'; |
| 10 import 'package:testing/testing.dart' | 10 import 'package:testing/testing.dart' |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Ticker ticker = new Ticker(); | 94 Ticker ticker = new Ticker(); |
| 95 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); | 95 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); |
| 96 platform.unbindCanonicalNames(); | 96 platform.unbindCanonicalNames(); |
| 97 dillTarget.loader.appendLibraries(platform); | 97 dillTarget.loader.appendLibraries(platform); |
| 98 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, | 98 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, |
| 99 dillTarget, context.uriTranslator, context.strongMode); | 99 dillTarget, context.uriTranslator, context.strongMode); |
| 100 | 100 |
| 101 Program p; | 101 Program p; |
| 102 try { | 102 try { |
| 103 sourceTarget.read(description.uri); | 103 sourceTarget.read(description.uri); |
| 104 await dillTarget.computeOutline(); | 104 await dillTarget.buildOutlines(); |
| 105 await sourceTarget.computeOutline(); | 105 await sourceTarget.buildOutlines(); |
| 106 p = await sourceTarget.writeProgram(null); | 106 p = await sourceTarget.buildProgram(); |
| 107 } on InputError catch (e, s) { | 107 } on InputError catch (e, s) { |
| 108 return fail(null, e.error, s); | 108 return fail(null, e.error, s); |
| 109 } | 109 } |
| 110 return pass(p); | 110 return pass(p); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 class ClosureConversion | 114 class ClosureConversion |
| 115 extends Step<Program, Program, ClosureConversionContext> { | 115 extends Step<Program, Program, ClosureConversionContext> { |
| 116 const ClosureConversion(); | 116 const ClosureConversion(); |
| 117 | 117 |
| 118 String get name => "closure conversion"; | 118 String get name => "closure conversion"; |
| 119 | 119 |
| 120 Future<Result<Program>> run( | 120 Future<Result<Program>> run( |
| 121 Program program, ClosureConversionContext testContext) async { | 121 Program program, ClosureConversionContext testContext) async { |
| 122 try { | 122 try { |
| 123 program = closure_conversion.transformProgram(program); | 123 program = closure_conversion.transformProgram(program); |
| 124 return pass(program); | 124 return pass(program); |
| 125 } catch (e, s) { | 125 } catch (e, s) { |
| 126 return crash(e, s); | 126 return crash(e, s); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 131 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
| OLD | NEW |