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

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

Issue 2416863003: Fix summarization of closures in toplevel variable declarations in part files. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_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 9ebc378ff40a5b99159100b428ca08bed1b617f7..ea25920c1156c792e894a411b3760042c0c6183e 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -1216,14 +1216,19 @@ class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink {
// TODO(paulberry): implement other cases as necessary
throw new UnimplementedError('${element._unlinkedExecutable.kind}');
}
- return addRawReference(element.name,
- numTypeParameters: element.typeParameters.length,
- containingReference:
- enclosingClass != null ? addReference(enclosingClass) : null,
- dependency: enclosingClass != null
- ? null
- : library.addDependency(element.library as LibraryElementForLink),
- kind: kind);
+ if (enclosingClass == null) {
+ return addRawReference(element.name,
+ numTypeParameters: element.typeParameters.length,
+ dependency:
+ library.addDependency(element.library as LibraryElementForLink),
+ unitNum: element.compilationUnit.unitNum,
+ kind: kind);
+ } else {
+ return addRawReference(element.name,
+ numTypeParameters: element.typeParameters.length,
+ containingReference: addReference(enclosingClass),
+ kind: kind);
+ }
} else if (element is FunctionElementForLink_Initializer) {
return addRawReference('',
containingReference: addReference(element.enclosingElement),
@@ -1231,6 +1236,7 @@ class CompilationUnitElementInBuildUnit extends CompilationUnitElementForLink {
} else if (element is TopLevelVariableElementForLink) {
return addRawReference(element.name,
dependency: library.addDependency(element.library),
+ unitNum: element.compilationUnit.unitNum,
kind: ReferenceKind.topLevelPropertyAccessor);
} else if (element is FieldElementForLink_ClassField) {
ClassElementForLink_Class enclosingClass = element.enclosingElement;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698