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

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

Issue 2669363004: Set fileUri when creating library builders. (Closed)
Patch Set: Created 3 years, 10 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
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.loader; 5 library fasta.loader;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future; 8 Future;
9 9
10 import 'dart:collection' show 10 import 'dart:collection' show
(...skipping 29 matching lines...) Expand all
40 LibraryBuilder first; 40 LibraryBuilder first;
41 41
42 int byteCount = 0; 42 int byteCount = 0;
43 43
44 Uri currentUriForCrashReporting; 44 Uri currentUriForCrashReporting;
45 45
46 Loader(this.target); 46 Loader(this.target);
47 47
48 Ticker get ticker => target.ticker; 48 Ticker get ticker => target.ticker;
49 49
50 LibraryBuilder read(Uri uri) { 50 /// Look up a library builder by the the name [uri], or if such doesn't
51 /// exist, create one. The canonical URI of the library is [uri], and its
52 /// actual location is [fileUri].
53 ///
54 /// Canonical URIs have schemes like "dart", or "package", and the actual
55 /// location is often a file URI.
56 LibraryBuilder read(Uri uri, [Uri fileUri]) {
51 firstSourceUri ??= uri; 57 firstSourceUri ??= uri;
52 LibraryBuilder builder = builders.putIfAbsent(uri, () { 58 LibraryBuilder builder = builders.putIfAbsent(uri, () {
53 LibraryBuilder library = target.createLibraryBuilder(uri); 59 if (fileUri == null) {
60 switch (uri.scheme) {
61 case "package":
62 case "dart":
63 fileUri = target.translateUri(uri);
64 break;
65
66 default:
67 fileUri = uri;
68 break;
69 }
70 }
71 LibraryBuilder library = target.createLibraryBuilder(uri, fileUri);
54 if (uri.scheme == "dart" && uri.path == "core") { 72 if (uri.scheme == "dart" && uri.path == "core") {
55 coreLibrary = library; 73 coreLibrary = library;
56 } 74 }
57 first ??= library; 75 first ??= library;
58 if (library.loader == this) { 76 if (library.loader == this) {
59 unparsedLibraries.addLast(library); 77 unparsedLibraries.addLast(library);
60 } 78 }
61 return library; 79 return library;
62 }); 80 });
63 return builder; 81 return builder;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 errors.addAll(library.compileTimeErrors); 141 errors.addAll(library.compileTimeErrors);
124 } 142 }
125 } 143 }
126 return errors; 144 return errors;
127 } 145 }
128 } 146 }
129 147
130 String format(double d, int fractionDigits, int width) { 148 String format(double d, int fractionDigits, int width) {
131 return d.toStringAsFixed(fractionDigits).padLeft(width); 149 return d.toStringAsFixed(fractionDigits).padLeft(width);
132 } 150 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | pkg/front_end/lib/src/fasta/source/source_library_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698