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' show PhysicalFileSystem; |
| 10 |
10 import 'package:testing/testing.dart' | 11 import 'package:testing/testing.dart' |
11 show Chain, ChainContext, Result, Step, TestDescription, runMe; | 12 show Chain, ChainContext, Result, Step, TestDescription, runMe; |
12 | 13 |
| 14 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart' |
| 15 show computePatchedSdk; |
| 16 |
13 import 'package:kernel/ast.dart' show Program; | 17 import 'package:kernel/ast.dart' show Program; |
14 | 18 |
15 import 'package:kernel/transformations/closure_conversion.dart' | 19 import 'package:kernel/transformations/closure_conversion.dart' |
16 as closure_conversion; | 20 as closure_conversion; |
17 | 21 |
18 import 'package:front_end/src/fasta/testing/kernel_chain.dart' | 22 import 'package:front_end/src/fasta/testing/kernel_chain.dart' |
19 show Print, MatchExpectation, WriteDill, ReadDill, Verify; | 23 show Print, MatchExpectation, WriteDill, ReadDill, Verify; |
20 | 24 |
21 import 'package:front_end/src/fasta/ticker.dart' show Ticker; | 25 import 'package:front_end/src/fasta/ticker.dart' show Ticker; |
22 | 26 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // TODO(29143): add `Run` step when Vectors are added to VM. | 62 // TODO(29143): add `Run` step when Vectors are added to VM. |
59 ]; | 63 ]; |
60 | 64 |
61 Future<Program> loadPlatform() async { | 65 Future<Program> loadPlatform() async { |
62 Uri sdk = await computePatchedSdk(); | 66 Uri sdk = await computePatchedSdk(); |
63 return loadProgramFromBinary(sdk.resolve('platform.dill').toFilePath()); | 67 return loadProgramFromBinary(sdk.resolve('platform.dill').toFilePath()); |
64 } | 68 } |
65 | 69 |
66 static Future<ClosureConversionContext> create( | 70 static Future<ClosureConversionContext> create( |
67 Chain suite, Map<String, String> environment) async { | 71 Chain suite, Map<String, String> environment) async { |
| 72 Uri sdk = await computePatchedSdk(); |
68 Uri packages = Uri.base.resolve(".packages"); | 73 Uri packages = Uri.base.resolve(".packages"); |
69 bool strongMode = environment.containsKey(STRONG_MODE); | 74 bool strongMode = environment.containsKey(STRONG_MODE); |
70 bool updateExpectations = environment["updateExpectations"] == "true"; | 75 bool updateExpectations = environment["updateExpectations"] == "true"; |
71 TranslateUri uriTranslator = | 76 TranslateUri uriTranslator = await TranslateUri |
72 await TranslateUri.parse(PhysicalFileSystem.instance, packages); | 77 .parse(PhysicalFileSystem.instance, sdk, packages: packages); |
73 return new ClosureConversionContext( | 78 return new ClosureConversionContext( |
74 strongMode, updateExpectations, uriTranslator); | 79 strongMode, updateExpectations, uriTranslator); |
75 } | 80 } |
76 } | 81 } |
77 | 82 |
78 Future<ClosureConversionContext> createContext( | 83 Future<ClosureConversionContext> createContext( |
79 Chain suite, Map<String, String> environment) async { | 84 Chain suite, Map<String, String> environment) async { |
80 environment["updateExpectations"] = | 85 environment["updateExpectations"] = |
81 const String.fromEnvironment("updateExpectations"); | 86 const String.fromEnvironment("updateExpectations"); |
82 return ClosureConversionContext.create(suite, environment); | 87 return ClosureConversionContext.create(suite, environment); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 try { | 127 try { |
123 program = closure_conversion.transformProgram(program); | 128 program = closure_conversion.transformProgram(program); |
124 return pass(program); | 129 return pass(program); |
125 } catch (e, s) { | 130 } catch (e, s) { |
126 return crash(e, s); | 131 return crash(e, s); |
127 } | 132 } |
128 } | 133 } |
129 } | 134 } |
130 | 135 |
131 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 136 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
OLD | NEW |