OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.testing.suite; | 5 library fasta.testing.suite; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:convert' show | 10 import 'dart:convert' show |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 steps.add(const WriteDill()); | 117 steps.add(const WriteDill()); |
118 steps.add(const Run()); | 118 steps.add(const Run()); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 Future<Program> createPlatform() { | 122 Future<Program> createPlatform() { |
123 return platform ??= new Future<Program>(() async { | 123 return platform ??= new Future<Program>(() async { |
124 DartLoader loader = await createLoader(); | 124 DartLoader loader = await createLoader(); |
125 Target target = getTarget( | 125 Target target = getTarget( |
126 "vm", new TargetFlags(strongMode: options.strongMode)); | 126 "vm", new TargetFlags(strongMode: options.strongMode)); |
127 Program program = loader.loadProgram( | 127 loader.loadProgram( |
128 Uri.base.resolve("pkg/fasta/test/platform.dart"), target: target); | 128 Uri.base.resolve("pkg/fasta/test/platform.dart"), target: target); |
| 129 var program = loader.program; |
129 if (loader.errors.isNotEmpty) { | 130 if (loader.errors.isNotEmpty) { |
130 throw loader.errors.join("\n"); | 131 throw loader.errors.join("\n"); |
131 } | 132 } |
132 Library mainLibrary = program.mainMethod.enclosingLibrary; | 133 Library mainLibrary = program.mainMethod.enclosingLibrary; |
133 program.uriToSource.remove(mainLibrary.fileUri); | 134 program.uriToSource.remove(mainLibrary.fileUri); |
134 program = new Program( | 135 program = new Program( |
135 program.libraries.where((Library l) => l != mainLibrary).toList(), | 136 program.libraries.where((Library l) => l != mainLibrary).toList(), |
136 program.uriToSource); | 137 program.uriToSource); |
137 target.performModularTransformations(program); | 138 target.performModularTransformations(program); |
138 target.performGlobalTransformations(program); | 139 target.performGlobalTransformations(program); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 p = await sourceTarget.writeOutline(null); | 184 p = await sourceTarget.writeOutline(null); |
184 if (fullCompile) { | 185 if (fullCompile) { |
185 p = await sourceTarget.writeProgram(null, astKind); | 186 p = await sourceTarget.writeProgram(null, astKind); |
186 } | 187 } |
187 } on InputError catch (e, s) { | 188 } on InputError catch (e, s) { |
188 return fail(null, e.error, s); | 189 return fail(null, e.error, s); |
189 } | 190 } |
190 return pass(p); | 191 return pass(p); |
191 } | 192 } |
192 } | 193 } |
OLD | NEW |