| 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' show PhysicalFileSystem; | 9 import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem; |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 import 'package:front_end/src/fasta/ticker.dart' show Ticker; | 27 import 'package:front_end/src/fasta/ticker.dart' show Ticker; |
| 28 | 28 |
| 29 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; | 29 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; |
| 30 | 30 |
| 31 import 'package:front_end/src/fasta/kernel/kernel_target.dart' | 31 import 'package:front_end/src/fasta/kernel/kernel_target.dart' |
| 32 show KernelTarget; | 32 show KernelTarget; |
| 33 | 33 |
| 34 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; | 34 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; |
| 35 | 35 |
| 36 import 'package:front_end/src/fasta/errors.dart' show InputError; | 36 import 'package:front_end/src/fasta/deprecated_problems.dart' |
| 37 show deprecated_InputError; |
| 37 | 38 |
| 38 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; | 39 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; |
| 39 | 40 |
| 40 import 'package:kernel/kernel.dart' show loadProgramFromBinary; | 41 import 'package:kernel/kernel.dart' show loadProgramFromBinary; |
| 41 | 42 |
| 42 import 'package:kernel/target/targets.dart' show TargetFlags; | 43 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 43 | 44 |
| 44 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; | 45 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 45 | 46 |
| 46 const String STRONG_MODE = " strong mode "; | 47 const String STRONG_MODE = " strong mode "; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 dillTarget.loader.appendLibraries(platform); | 110 dillTarget.loader.appendLibraries(platform); |
| 110 KernelTarget sourceTarget = new KernelTarget( | 111 KernelTarget sourceTarget = new KernelTarget( |
| 111 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); | 112 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); |
| 112 | 113 |
| 113 Program p; | 114 Program p; |
| 114 try { | 115 try { |
| 115 sourceTarget.read(description.uri); | 116 sourceTarget.read(description.uri); |
| 116 await dillTarget.buildOutlines(); | 117 await dillTarget.buildOutlines(); |
| 117 await sourceTarget.buildOutlines(); | 118 await sourceTarget.buildOutlines(); |
| 118 p = await sourceTarget.buildProgram(); | 119 p = await sourceTarget.buildProgram(); |
| 119 } on InputError catch (e, s) { | 120 } on deprecated_InputError catch (e, s) { |
| 120 return fail(null, e.error, s); | 121 return fail(null, e.error, s); |
| 121 } | 122 } |
| 122 return pass(p); | 123 return pass(p); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 class ClosureConversion | 127 class ClosureConversion |
| 127 extends Step<Program, Program, ClosureConversionContext> { | 128 extends Step<Program, Program, ClosureConversionContext> { |
| 128 const ClosureConversion(); | 129 const ClosureConversion(); |
| 129 | 130 |
| 130 String get name => "closure conversion"; | 131 String get name => "closure conversion"; |
| 131 | 132 |
| 132 Future<Result<Program>> run( | 133 Future<Result<Program>> run( |
| 133 Program program, ClosureConversionContext testContext) async { | 134 Program program, ClosureConversionContext testContext) async { |
| 134 try { | 135 try { |
| 135 CoreTypes coreTypes = new CoreTypes(program); | 136 CoreTypes coreTypes = new CoreTypes(program); |
| 136 Library library = program.libraries | 137 Library library = program.libraries |
| 137 .firstWhere((Library library) => library.importUri.scheme != "dart"); | 138 .firstWhere((Library library) => library.importUri.scheme != "dart"); |
| 138 closure_conversion.transformLibraries(coreTypes, <Library>[library]); | 139 closure_conversion.transformLibraries(coreTypes, <Library>[library]); |
| 139 return pass(program); | 140 return pass(program); |
| 140 } catch (e, s) { | 141 } catch (e, s) { |
| 141 return crash(e, s); | 142 return crash(e, s); |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 } | 145 } |
| 145 | 146 |
| 146 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 147 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
| OLD | NEW |