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

Unified Diff: pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Issue 2747173002: Handle 'part of' declarations with URI correctly in Fasta. (Closed)
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/outline_builder.dart ('k') | tests/language/language_kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/source/source_library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 5bc51159d49a3500ed579b5119c889c5adc8b744..b676740f1dff32a5e5ca8d948782219946207fa6 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -61,7 +61,9 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
String name;
- String partOf;
+ String partOfName;
+
+ Uri partOfUri;
List<MetadataBuilder> metadata;
@@ -79,7 +81,7 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
Uri get uri;
- bool get isPart => partOf != null;
+ bool get isPart => partOfName != null || partOfUri != null;
Map<String, Builder> get members => libraryDeclaration.members;
@@ -155,8 +157,9 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
parts.add(loader.read(resolvedUri, newFileUri));
}
- void addPartOf(List<MetadataBuilder> metadata, String name) {
- partOf = name;
+ void addPartOf(List<MetadataBuilder> metadata, String name, String uri) {
+ partOfName = name;
+ partOfUri = uri == null ? null : this.uri.resolve(uri);
}
void addClass(
@@ -344,7 +347,7 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
void includePart(SourceLibraryBuilder<T, R> part) {
if (name != null) {
- if (part.partOf == null) {
+ if (!part.isPart) {
warning(
part.fileUri,
-1,
@@ -353,12 +356,11 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
parts.remove(part);
return;
}
- if (part.partOf != name) {
- warning(
- part.fileUri,
- -1,
- "Is part of '${part.partOf}' but is used as "
- "a part by '${name}' ($uri).");
+ if (part.partOfName != name && part.partOfUri != uri) {
+ String partName = part.partOfName ?? "${part.partOfUri}";
+ String myName = name == null ? "'$uri'" : "'${name}' ($uri)";
+ warning(part.fileUri, -1,
+ "Is part of '$partName' but is used as a part by $myName.");
parts.remove(part);
return;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/outline_builder.dart ('k') | tests/language/language_kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698