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:io' show File; | 7 import 'dart:io' show File; |
8 | 8 |
9 import 'dart:async' show Future; | 9 import 'dart:async' show Future; |
10 | 10 |
(...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 //const Run(), | 59 //const Run(), |
60 ]; | 60 ]; |
61 | 61 |
62 static Future<ClosureConversionContext> create( | 62 static Future<ClosureConversionContext> create( |
63 Chain suite, Map<String, String> environment) async { | 63 Chain suite, Map<String, String> environment, bool strongMode) async { |
64 bool strongMode = environment.containsKey(STRONG_MODE); | |
65 bool updateExpectations = environment["updateExpectations"] == "true"; | 64 bool updateExpectations = environment["updateExpectations"] == "true"; |
66 return new ClosureConversionContext(strongMode, updateExpectations); | 65 return new ClosureConversionContext(strongMode, updateExpectations); |
67 } | 66 } |
68 } | 67 } |
69 | 68 |
70 Future<ClosureConversionContext> createContext( | 69 Future<ClosureConversionContext> createContext( |
71 Chain suite, Map<String, String> environment) async { | 70 Chain suite, Map<String, String> environment) async { |
| 71 bool strongMode = environment.containsKey(STRONG_MODE); |
72 environment["updateExpectations"] = | 72 environment["updateExpectations"] = |
73 const String.fromEnvironment("updateExpectations"); | 73 const String.fromEnvironment("updateExpectations"); |
74 return ClosureConversionContext.create(suite, environment); | 74 return ClosureConversionContext.create(suite, environment, strongMode); |
75 } | 75 } |
76 | 76 |
77 class ClosureConversion | 77 class ClosureConversion |
78 extends Step<Program, Program, ClosureConversionContext> { | 78 extends Step<Program, Program, ClosureConversionContext> { |
79 const ClosureConversion(); | 79 const ClosureConversion(); |
80 | 80 |
81 String get name => "closure conversion"; | 81 String get name => "closure conversion"; |
82 | 82 |
83 Future<Result<Program>> run( | 83 Future<Result<Program>> run( |
84 Program program, ClosureConversionContext testContext) async { | 84 Program program, ClosureConversionContext testContext) async { |
(...skipping 23 matching lines...) Expand all Loading... |
108 .run(vm.toFilePath(), [generated.path, "Hello, World!"]); | 108 .run(vm.toFilePath(), [generated.path, "Hello, World!"]); |
109 print(process.output); | 109 print(process.output); |
110 return process.toResult(); | 110 return process.toResult(); |
111 } finally { | 111 } finally { |
112 generated.parent.delete(recursive: true); | 112 generated.parent.delete(recursive: true); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 117 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); |
OLD | NEW |