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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 const Verify(true), | 53 const Verify(true), |
54 new MatchExpectation(".expect", | 54 new MatchExpectation(".expect", |
55 updateExpectations: updateExpectations), | 55 updateExpectations: updateExpectations), |
56 const WriteDill(), | 56 const WriteDill(), |
57 const ReadDill(), | 57 const ReadDill(), |
58 // TODO(29143): add `Run` step when Vectors are added to VM. | 58 // TODO(29143): add `Run` step when Vectors are added to VM. |
59 ]; | 59 ]; |
60 | 60 |
61 Future<Program> loadPlatform() async { | 61 Future<Program> loadPlatform() async { |
62 Uri sdk = await computePatchedSdk(); | 62 Uri sdk = await computePatchedSdk(); |
63 return loadProgramFromBinary(sdk.resolve('platform.dill').toFilePath()); | 63 String platformPath = sdk.resolve('platform.dill').toFilePath(); |
64 return loadProgramFromBinary(platformPath); | |
ahe
2017/05/11 10:09:49
Why this change?
scheglov
2017/05/11 15:53:11
I will roll this back.
| |
64 } | 65 } |
65 | 66 |
66 static Future<ClosureConversionContext> create( | 67 static Future<ClosureConversionContext> create( |
67 Chain suite, Map<String, String> environment) async { | 68 Chain suite, Map<String, String> environment) async { |
68 Uri packages = Uri.base.resolve(".packages"); | 69 Uri packages = Uri.base.resolve(".packages"); |
69 bool strongMode = environment.containsKey(STRONG_MODE); | 70 bool strongMode = environment.containsKey(STRONG_MODE); |
70 bool updateExpectations = environment["updateExpectations"] == "true"; | 71 bool updateExpectations = environment["updateExpectations"] == "true"; |
71 TranslateUri uriTranslator = | 72 TranslateUri uriTranslator = |
72 await TranslateUri.parse(PhysicalFileSystem.instance, packages); | 73 await TranslateUri.parse(PhysicalFileSystem.instance, packages); |
73 return new ClosureConversionContext( | 74 return new ClosureConversionContext( |
(...skipping 12 matching lines...) Expand all Loading... | |
86 extends Step<TestDescription, Program, ClosureConversionContext> { | 87 extends Step<TestDescription, Program, ClosureConversionContext> { |
87 const FastaCompile(); | 88 const FastaCompile(); |
88 | 89 |
89 String get name => "fasta compilation"; | 90 String get name => "fasta compilation"; |
90 | 91 |
91 Future<Result<Program>> run( | 92 Future<Result<Program>> run( |
92 TestDescription description, ClosureConversionContext context) async { | 93 TestDescription description, ClosureConversionContext context) async { |
93 Program platform = await context.loadPlatform(); | 94 Program platform = await context.loadPlatform(); |
94 Ticker ticker = new Ticker(); | 95 Ticker ticker = new Ticker(); |
95 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); | 96 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); |
96 dillTarget.loader | 97 dillTarget.loader.appendLibraries(platform); |
97 ..input = Uri.parse("org.dartlang:platform") // Make up a name. | |
98 ..setProgram(platform); | |
99 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, | 98 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, |
100 dillTarget, context.uriTranslator, context.strongMode); | 99 dillTarget, context.uriTranslator, context.strongMode); |
101 | 100 |
102 Program p; | 101 Program p; |
103 try { | 102 try { |
104 sourceTarget.read(description.uri); | 103 sourceTarget.read(description.uri); |
105 await dillTarget.writeOutline(null); | 104 await dillTarget.writeOutline(null); |
106 await sourceTarget.writeOutline(null); | 105 await sourceTarget.writeOutline(null); |
107 p = await sourceTarget.writeProgram(null); | 106 p = await sourceTarget.writeProgram(null); |
108 } on InputError catch (e, s) { | 107 } on InputError catch (e, s) { |
(...skipping 14 matching lines...) Expand all Loading... | |
123 try { | 122 try { |
124 program = closure_conversion.transformProgram(program); | 123 program = closure_conversion.transformProgram(program); |
125 return pass(program); | 124 return pass(program); |
126 } catch (e, s) { | 125 } catch (e, s) { |
127 return crash(e, s); | 126 return crash(e, s); |
128 } | 127 } |
129 } | 128 } |
130 } | 129 } |
131 | 130 |
132 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 131 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
OLD | NEW |