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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Program program = 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 target.transformProgram(program); | 129 target.transformProgram(program); |
130 if (loader.errors.isNotEmpty) { | 130 if (loader.errors.isNotEmpty) { |
131 throw loader.errors.join("\n"); | 131 throw loader.errors.join("\n"); |
132 } | 132 } |
133 Library mainLibrary = program.mainMethod.enclosingLibrary; | 133 Library mainLibrary = program.mainMethod.enclosingLibrary; |
134 program.uriToLineStarts.remove(mainLibrary.fileUri); | 134 program.uriToSource.remove(mainLibrary.fileUri); |
135 return new Program( | 135 return new Program( |
136 program.libraries.where((Library l) => l != mainLibrary).toList(), | 136 program.libraries.where((Library l) => l != mainLibrary).toList(), |
137 program.uriToLineStarts); | 137 program.uriToSource); |
138 }); | 138 }); |
139 } | 139 } |
140 | 140 |
141 static Future<FeContext> create(Chain suite, Map<String, String> environment, | 141 static Future<FeContext> create(Chain suite, Map<String, String> environment, |
142 String sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, | 142 String sdk, Uri vm, Uri packages, bool strongMode, DartSdk dartSdk, |
143 bool updateExpectations) async { | 143 bool updateExpectations) async { |
144 TranslateUri uriTranslator = await TranslateUri.parse(packages); | 144 TranslateUri uriTranslator = await TranslateUri.parse(packages); |
145 String astKindString = environment[AST_KIND_INDEX]; | 145 String astKindString = environment[AST_KIND_INDEX]; |
146 AstKind astKind = astKindString == null | 146 AstKind astKind = astKindString == null |
147 ? null : AstKind.values[int.parse(astKindString)]; | 147 ? null : AstKind.values[int.parse(astKindString)]; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 p = await sourceTarget.writeOutline(null); | 181 p = await sourceTarget.writeOutline(null); |
182 if (fullCompile) { | 182 if (fullCompile) { |
183 p = await sourceTarget.writeProgram(null, astKind); | 183 p = await sourceTarget.writeProgram(null, astKind); |
184 } | 184 } |
185 } on InputError catch (e, s) { | 185 } on InputError catch (e, s) { |
186 return fail(null, e.error, s); | 186 return fail(null, e.error, s); |
187 } | 187 } |
188 return pass(p); | 188 return pass(p); |
189 } | 189 } |
190 } | 190 } |
OLD | NEW |