| 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 23 matching lines...) Expand all Loading... |
| 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/errors.dart' show InputError; |
| 37 | 37 |
| 38 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; | 38 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; |
| 39 | 39 |
| 40 import 'package:kernel/kernel.dart' show loadProgramFromBinary; | 40 import 'package:kernel/kernel.dart' show loadProgramFromBinary; |
| 41 | 41 |
| 42 import 'package:kernel/target/targets.dart' show TargetFlags; | 42 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 43 | 43 |
| 44 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 45 |
| 44 const String STRONG_MODE = " strong mode "; | 46 const String STRONG_MODE = " strong mode "; |
| 45 | 47 |
| 46 class ClosureConversionContext extends ChainContext { | 48 class ClosureConversionContext extends ChainContext { |
| 47 final bool strongMode; | 49 final bool strongMode; |
| 48 | 50 |
| 49 final TranslateUri uriTranslator; | 51 final TranslateUri uriTranslator; |
| 50 | 52 |
| 51 final List<Step> steps; | 53 final List<Step> steps; |
| 52 | 54 |
| 53 ClosureConversionContext( | 55 ClosureConversionContext( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 class FastaCompile | 96 class FastaCompile |
| 95 extends Step<TestDescription, Program, ClosureConversionContext> { | 97 extends Step<TestDescription, Program, ClosureConversionContext> { |
| 96 const FastaCompile(); | 98 const FastaCompile(); |
| 97 | 99 |
| 98 String get name => "fasta compilation"; | 100 String get name => "fasta compilation"; |
| 99 | 101 |
| 100 Future<Result<Program>> run( | 102 Future<Result<Program>> run( |
| 101 TestDescription description, ClosureConversionContext context) async { | 103 TestDescription description, ClosureConversionContext context) async { |
| 102 Program platform = await context.loadPlatform(); | 104 Program platform = await context.loadPlatform(); |
| 103 Ticker ticker = new Ticker(); | 105 Ticker ticker = new Ticker(); |
| 104 DillTarget dillTarget = new DillTarget( | 106 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, |
| 105 ticker, context.uriTranslator, "vm_fasta", | 107 new VmFastaTarget(new TargetFlags(strongMode: context.strongMode))); |
| 106 flags: new TargetFlags(strongMode: context.strongMode)); | |
| 107 platform.unbindCanonicalNames(); | 108 platform.unbindCanonicalNames(); |
| 108 dillTarget.loader.appendLibraries(platform); | 109 dillTarget.loader.appendLibraries(platform); |
| 109 KernelTarget sourceTarget = new KernelTarget( | 110 KernelTarget sourceTarget = new KernelTarget( |
| 110 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); | 111 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); |
| 111 | 112 |
| 112 Program p; | 113 Program p; |
| 113 try { | 114 try { |
| 114 sourceTarget.read(description.uri); | 115 sourceTarget.read(description.uri); |
| 115 await dillTarget.buildOutlines(); | 116 await dillTarget.buildOutlines(); |
| 116 await sourceTarget.buildOutlines(); | 117 await sourceTarget.buildOutlines(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 134 CoreTypes coreTypes = new CoreTypes(program); | 135 CoreTypes coreTypes = new CoreTypes(program); |
| 135 program = closure_conversion.transformProgram(coreTypes, program); | 136 program = closure_conversion.transformProgram(coreTypes, program); |
| 136 return pass(program); | 137 return pass(program); |
| 137 } catch (e, s) { | 138 } catch (e, s) { |
| 138 return crash(e, s); | 139 return crash(e, s); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 } | 142 } |
| 142 | 143 |
| 143 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 144 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
| OLD | NEW |