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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 1382143005: Limit hints on empty hide on package imports. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 442c95700c89a4801d4d0f63bff87ecae1db4e9a..241516b4319368499854dbf9996613841aa7d50b 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -899,9 +899,11 @@ class LibraryDependencyNode {
pendingExportMap[exportedElement] = exports.prepend(export);
}
});
- reporter.withCurrentElement(library, () {
- checkLibraryDependency(reporter, export.node, exportedLibraryElement);
- });
+ if (!reporter.options.suppressHints) {
+ reporter.withCurrentElement(library, () {
+ checkLibraryDependency(reporter, export.node, exportedLibraryElement);
+ });
+ }
}
/**
@@ -1069,12 +1071,26 @@ class LibraryDependencyNode {
String name = identifier.source;
Element element = library.findExported(name);
if (element == null) {
- reporter.reportHintMessage(
- identifier,
- combinator.isHide
- ? MessageKind.EMPTY_HIDE : MessageKind.EMPTY_SHOW,
- {'uri': library.canonicalUri,
- 'name': name});
+ if (combinator.isHide) {
+ if (library.isPackageLibrary &&
+ !reporter.options.showPackageWarnings) {
+ // Only report hide hint on packages if we show warnings on these:
+ // The hide may be non-empty in some versions of the package, in
+ // which case you shouldn't remove the combinator.
+ continue;
+ }
+ reporter.reportHintMessage(
+ identifier,
+ MessageKind.EMPTY_HIDE,
+ {'uri': library.canonicalUri,
+ 'name': name});
+ } else {
+ reporter.reportHintMessage(
+ identifier,
+ MessageKind.EMPTY_SHOW,
+ {'uri': library.canonicalUri,
+ 'name': name});
+ }
}
}
}
@@ -1156,9 +1172,11 @@ class LibraryDependencyHandler implements LibraryLoader {
node.registerImports(reporter);
});
- nodeMap.forEach((LibraryElement library, LibraryDependencyNode node) {
- node.checkCombinators(reporter);
- });
+ if (!reporter.options.suppressHints) {
+ nodeMap.forEach((LibraryElement library, LibraryDependencyNode node) {
+ node.checkCombinators(reporter);
+ });
+ }
}
/// Registers that [library] depends on [loadedLibrary] through
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart ('k') | tests/compiler/dart2js/combinator_hint_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698