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

Unified Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1961753002: Fix reference sharing in the event that import prefixes are used. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/test/src/summary/summary_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index ae8bd48d2ebba55807afbf095a3412a8f4921006..ee222edc865bbcd84179853c658a1a8011fec2df 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -1079,6 +1079,16 @@ class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink {
List<UnlinkedReference> unlinkedReferences = _unlinkedUnit.references;
for (int i = 0; i < linkedReferences.length; i++) {
LinkedReferenceBuilder linkedReference = linkedReferences[i];
+ int candidateContainingReference = i < unlinkedReferences.length
+ ? unlinkedReferences[i].prefixReference
+ : linkedReference.containingReference;
+ if (candidateContainingReference != 0 &&
+ linkedReferences[candidateContainingReference].kind ==
+ ReferenceKind.prefix) {
+ // We don't need to match containing references when they are prefixes,
+ // since the relevant information is in linkedReference.dependency.
+ candidateContainingReference = 0;
+ }
if (linkedReference.dependency == dependency &&
(i < unlinkedReferences.length
? unlinkedReferences[i].name
@@ -1086,10 +1096,7 @@ class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink {
name &&
linkedReference.numTypeParameters == numTypeParameters &&
linkedReference.unit == unitNum &&
- (i < unlinkedReferences.length
- ? unlinkedReferences[i].prefixReference
- : linkedReference.containingReference) ==
- containingReference &&
+ candidateContainingReference == containingReference &&
linkedReference.kind == kind) {
return i;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698