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

Unified Diff: pkg/analysis_server/lib/src/services/correction/namespace.dart

Issue 2226613004: Suppress follow-on errors when a file is imported with either a prefix or a show clause (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/analysis_server/lib/src/services/correction/namespace.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/namespace.dart b/pkg/analysis_server/lib/src/services/correction/namespace.dart
index 0aa0b8d2695904bdc76aede877213c09253fcdb7..87c38dd1ab610244acaa94339870365814a7f5a8 100644
--- a/pkg/analysis_server/lib/src/services/correction/namespace.dart
+++ b/pkg/analysis_server/lib/src/services/correction/namespace.dart
@@ -37,13 +37,14 @@ Map<String, Element> getExportNamespaceForLibrary(LibraryElement library) {
}
/**
- * Returns the [ImportElement] that is referenced by [prefixNode] with
- * an [PrefixElement], maybe `null`.
+ * Return the [ImportElement] that is referenced by [prefixNode], or `null` if
+ * the node does not reference a prefix or if we cannot determine which import
+ * is being referenced.
*/
ImportElement getImportElement(SimpleIdentifier prefixNode) {
- if (prefixNode.parent is ImportDirective) {
- ImportDirective importDirective = prefixNode.parent;
- return importDirective.element;
+ AstNode parent = prefixNode.parent;
+ if (parent is ImportDirective) {
+ return parent.element;
}
ImportElementInfo info = internal_getImportElementInfo(prefixNode);
return info?.element;

Powered by Google App Engine
This is Rietveld 408576698