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

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

Issue 1619253003: Include explicit constructors and static methods into UnlinkedPublicName (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/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 794e5a9e07df04bbbac4cf38ef8991d740b74f57..f4c7595f78e73d675aa1f694bf3de629e17a5748 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -180,7 +180,8 @@ class _CompilationUnitSerializer {
names.add(new UnlinkedPublicNameBuilder(
kind: ReferenceKind.classOrEnum,
name: cls.name,
- numTypeParameters: cls.typeParameters.length));
+ numTypeParameters: cls.typeParameters.length,
+ executables: serializePublicStaticMethodsAndConstructors(cls)));
}
}
for (ClassElement enm in compilationUnit.enums) {
@@ -567,6 +568,35 @@ class _CompilationUnitSerializer {
}
/**
+ * If [cls] is a class, return the list of its public static methods and
+ * constructors. Otherwise return `null`.
+ */
+ List<UnlinkedPublicNameBuilder> serializePublicStaticMethodsAndConstructors(
+ ClassElement cls) {
+ if (cls.kind == ElementKind.CLASS) {
+ List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[];
+ for (MethodElement method in cls.methods) {
+ if (method.isStatic && method.isPublic) {
Paul Berry 2016/01/25 13:10:04 Do we need to filter out operators or does `method
scheglov 2016/01/25 17:27:09 Operators cannot be static, so we don't have stati
+ bs.add(new UnlinkedPublicNameBuilder(
+ name: method.name,
+ kind: ReferenceKind.staticMethod,
+ numTypeParameters: method.typeParameters.length));
+ }
+ }
+ for (ConstructorElement constructor in cls.constructors) {
+ if (constructor.isPublic && !constructor.isSynthetic) {
+ bs.add(new UnlinkedPublicNameBuilder(
+ name: constructor.name,
+ kind: ReferenceKind.constructor,
+ numTypeParameters: 0));
+ }
+ }
+ return bs;
+ }
+ return null;
+ }
+
+ /**
* Compute the reference index which should be stored in a [EntityRef].
*
* If [linked] is true, and a new reference has to be created, the reference

Powered by Google App Engine
This is Rietveld 408576698