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

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

Issue 1543403002: Create a section of the summary for public namespace information. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 6a2516dae10eef62f5592bb7d3fe50b880002c0f..a10960f0cde9098ef778eb04f465051b10a68b94 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -163,22 +163,57 @@ class _LibrarySerializer {
prelinkedReferences = <PrelinkedReferenceBuilder>[
encodePrelinkedReference(ctx, kind: PrelinkedReferenceKind.classOrEnum)
];
+ List<UnlinkedPublicNameBuilder> names = <UnlinkedPublicNameBuilder>[];
+ for (PropertyAccessorElement accessor in element.accessors) {
+ if (accessor.isPublic) {
+ names.add(encodeUnlinkedPublicName(ctx,
+ kind: PrelinkedReferenceKind.other, name: accessor.name));
+ }
+ }
+ for (ClassElement cls in element.types) {
+ if (cls.isPublic) {
+ names.add(encodeUnlinkedPublicName(ctx,
+ kind: PrelinkedReferenceKind.classOrEnum, name: cls.name));
+ }
+ }
+ for (ClassElement enm in element.enums) {
+ if (enm.isPublic) {
+ names.add(encodeUnlinkedPublicName(ctx,
+ kind: PrelinkedReferenceKind.classOrEnum, name: enm.name));
+ }
+ }
+ for (FunctionElement function in element.functions) {
+ if (function.isPublic) {
+ names.add(encodeUnlinkedPublicName(ctx,
+ kind: PrelinkedReferenceKind.other, name: function.name));
+ }
+ }
+ for (FunctionTypeAliasElement typedef in element.functionTypeAliases) {
+ if (typedef.isPublic) {
+ names.add(encodeUnlinkedPublicName(ctx,
+ kind: PrelinkedReferenceKind.typedef, name: typedef.name));
+ }
+ }
if (unitNum == 0) {
+ if (libraryElement.name.isNotEmpty) {
+ b.libraryName = libraryElement.name;
+ }
+ b.publicNamespace = encodeUnlinkedPublicNamespace(ctx,
+ exports: libraryElement.exports.map(serializeExport).toList(),
+ parts: libraryElement.parts
+ .map((CompilationUnitElement e) =>
+ encodeUnlinkedPart(ctx, uri: e.uri))
+ .toList(),
+ names: names);
+ b.imports = libraryElement.imports.map(serializeImport).toList();
+ } else {
// TODO(paulberry): we need to figure out a way to record library, part,
// import, and export declarations that appear in non-defining
// compilation units (even though such declarations are prohibited by the
// language), so that if the user makes code changes that cause a
// non-defining compilation unit to become a defining compilation unit,
// we can create a correct summary by simply re-linking.
- if (libraryElement.name.isNotEmpty) {
- b.libraryName = libraryElement.name;
- }
- b.exports = libraryElement.exports.map(serializeExport).toList();
- b.imports = libraryElement.imports.map(serializeImport).toList();
- b.parts = libraryElement.parts
- .map(
- (CompilationUnitElement e) => encodeUnlinkedPart(ctx, uri: e.uri))
- .toList();
+ b.publicNamespace = encodeUnlinkedPublicNamespace(ctx, names: names);
}
b.classes = element.types.map(serializeClass).toList();
b.enums = element.enums.map(serializeEnum).toList();
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698