Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart

Issue 2742333006: Move patch file generation to fasta. (Closed)
Patch Set: Extract method. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | pkg/front_end/lib/src/fasta/vm.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File, IOSink; 9 import 'dart:io' show File, IOSink;
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 264 }
265 if (uri == null) return program; 265 if (uri == null) return program;
266 return await writeLinkedProgram(uri, program, isFullProgram: true); 266 return await writeLinkedProgram(uri, program, isFullProgram: true);
267 } on InputError catch (e) { 267 } on InputError catch (e) {
268 return handleInputError(uri, e, isFullProgram: true); 268 return handleInputError(uri, e, isFullProgram: true);
269 } catch (e, s) { 269 } catch (e, s) {
270 return reportCrash(e, s, loader?.currentUriForCrashReporting); 270 return reportCrash(e, s, loader?.currentUriForCrashReporting);
271 } 271 }
272 } 272 }
273 273
274 Future writeDepsFile(Uri output, Uri depsFile) async { 274 Future writeDepsFile(Uri output, Uri depsFile,
275 {Iterable<Uri> extraDependencies}) async {
276 Uri base = depsFile.resolve(".");
277 String toRelativeFilePath(Uri uri) {
278 return Uri.parse(relativizeUri(uri, base: base)).toFilePath();
279 }
280
275 if (loader.first == null) return null; 281 if (loader.first == null) return null;
276 StringBuffer sb = new StringBuffer(); 282 StringBuffer sb = new StringBuffer();
277 Uri base = depsFile.resolve("."); 283 sb.write(toRelativeFilePath(output));
278 sb.write(Uri.parse(relativizeUri(output, base: base)).toFilePath());
279 sb.write(":"); 284 sb.write(":");
280 for (Uri dependency in loader.getDependencies()) { 285 Set<String> allDependencies = new Set<String>();
286 allDependencies.addAll(loader.getDependencies().map(toRelativeFilePath));
287 if (extraDependencies != null) {
288 allDependencies.addAll(extraDependencies.map(toRelativeFilePath));
289 }
290 for (String path in allDependencies) {
281 sb.write(" "); 291 sb.write(" ");
282 sb.write(Uri.parse(relativizeUri(dependency, base: base)).toFilePath()); 292 sb.write(path);
283 } 293 }
284 sb.writeln(); 294 sb.writeln();
285 await new File.fromUri(depsFile).writeAsString("$sb"); 295 await new File.fromUri(depsFile).writeAsString("$sb");
296 ticker.logMs("Wrote deps file");
286 } 297 }
287 298
288 Program erroneousProgram(bool isFullProgram) { 299 Program erroneousProgram(bool isFullProgram) {
289 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); 300 Uri uri = loader.first?.uri ?? Uri.parse("error:error");
290 Uri fileUri = loader.first?.fileUri ?? uri; 301 Uri fileUri = loader.first?.fileUri ?? uri;
291 KernelLibraryBuilder library = 302 KernelLibraryBuilder library =
292 new KernelLibraryBuilder(uri, fileUri, loader); 303 new KernelLibraryBuilder(uri, fileUri, loader);
293 loader.first = library; 304 loader.first = library;
294 if (isFullProgram) { 305 if (isFullProgram) {
295 // If this is an outline, we shouldn't add an executable main 306 // If this is an outline, we shouldn't add an executable main
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 668 }
658 for (Constructor constructor in superclass.constructors) { 669 for (Constructor constructor in superclass.constructors) {
659 if (constructor.name.name.isEmpty) { 670 if (constructor.name.name.isEmpty) {
660 return constructor.function.requiredParameterCount == 0 671 return constructor.function.requiredParameterCount == 0
661 ? constructor 672 ? constructor
662 : null; 673 : null;
663 } 674 }
664 } 675 }
665 return null; 676 return null;
666 } 677 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | pkg/front_end/lib/src/fasta/vm.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698