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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/loader.dart
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index 18081ab420bb6fdc2c7282148a75db51da4ca7e3..95ee99bde79986488c4bae88d5b09ffab8e357ef 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -47,10 +47,28 @@ abstract class Loader<L> {
Ticker get ticker => target.ticker;
- LibraryBuilder read(Uri uri) {
+ /// Look up a library builder by the the name [uri], or if such doesn't
+ /// exist, create one. The canonical URI of the library is [uri], and its
+ /// actual location is [fileUri].
+ ///
+ /// Canonical URIs have schemes like "dart", or "package", and the actual
+ /// location is often a file URI.
+ LibraryBuilder read(Uri uri, [Uri fileUri]) {
firstSourceUri ??= uri;
LibraryBuilder builder = builders.putIfAbsent(uri, () {
- LibraryBuilder library = target.createLibraryBuilder(uri);
+ if (fileUri == null) {
+ switch (uri.scheme) {
+ case "package":
+ case "dart":
+ fileUri = target.translateUri(uri);
+ break;
+
+ default:
+ fileUri = uri;
+ break;
+ }
+ }
+ LibraryBuilder library = target.createLibraryBuilder(uri, fileUri);
if (uri.scheme == "dart" && uri.path == "core") {
coreLibrary = library;
}
« 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