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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1854003003: Fixes for import/export directive resolution and tasks graph. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index db8ba3dcf6530b0e320aacb57fbd38529ef9e388..0a3fdb82f353d6fb58e828030793f74915074cb5 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -2852,6 +2852,13 @@ class DirectiveResolver extends SimpleAstVisitor with ExistingElementResolver {
}
for (ExportElement export in exports) {
if (export.exportedLibrary.source == source) {
+ // Must have the same offset.
+ if (export.nameOffset != node.offset) {
+ continue;
+ }
+ // In general we should also match combinators.
+ // But currently we invalidate element model on any directive change.
+ // So, either the combinators are the same, or we build new elements.
return export;
}
}
@@ -2874,17 +2881,18 @@ class DirectiveResolver extends SimpleAstVisitor with ExistingElementResolver {
for (ImportElement element in imports) {
if (element.importedLibrary.source == source) {
foundSource = true;
- PrefixElement prefixElement = element.prefix;
- if (prefix == null) {
- if (prefixElement == null) {
- return element;
- }
- } else {
- if (prefixElement != null &&
- prefix.name == prefixElement.displayName) {
- return element;
- }
+ // Must have the same offset.
+ if (element.nameOffset != node.offset) {
+ continue;
+ }
+ // Must have the same prefix.
+ if (element.prefix?.displayName != prefix?.name) {
+ continue;
}
+ // In general we should also match combinators.
+ // But currently we invalidate element model on any directive change.
+ // So, either the combinators are the same, or we build new elements.
+ return element;
}
}
if (foundSource) {
« no previous file with comments | « no previous file | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698