Chromium Code Reviews| 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 26665db4aa98ab95157e2a6f9e96faac67db8356..3678933885187f3b24822c4486a04b05cd6d91ed 100644 |
| --- a/pkg/analyzer/lib/src/summary/summarize_elements.dart |
| +++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart |
| @@ -183,7 +183,7 @@ class _CompilationUnitSerializer { |
| kind: ReferenceKind.classOrEnum, |
| name: cls.name, |
| numTypeParameters: cls.typeParameters.length, |
| - executables: serializePublicStaticMethodsAndConstructors(cls))); |
| + constMembers: serializeClassConstMembers(cls))); |
| } |
| } |
| for (ClassElement enm in compilationUnit.enums) { |
| @@ -376,6 +376,43 @@ class _CompilationUnitSerializer { |
| } |
| /** |
| + * If [cls] is a class, return the list of its members available for |
| + * constants - static constant fields, static methods and constructors. |
| + * Otherwise return `null`. |
| + */ |
| + List<UnlinkedPublicNameBuilder> serializeClassConstMembers(ClassElement cls) { |
| + if (cls.kind == ElementKind.CLASS) { |
| + List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[]; |
| + for (FieldElement field in cls.fields) { |
| + if (field.isStatic && field.isConst && field.isPublic) { |
| + bs.add(new UnlinkedPublicNameBuilder( |
| + name: field.name, |
| + kind: ReferenceKind.constField, |
| + numTypeParameters: 0)); |
| + } |
| + } |
| + for (MethodElement method in cls.methods) { |
| + if (method.isStatic && method.isPublic) { |
| + 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) { |
|
Paul Berry
2016/01/26 18:16:49
Let's just store the const constructors since they
scheglov
2016/01/26 18:44:14
Done.
|
| + bs.add(new UnlinkedPublicNameBuilder( |
| + name: constructor.name, |
| + kind: ReferenceKind.constructor, |
| + numTypeParameters: 0)); |
| + } |
| + } |
| + return bs; |
| + } |
| + return null; |
| + } |
| + |
| + /** |
| * Serialize the given [combinator] into an [UnlinkedCombinator]. |
| */ |
| UnlinkedCombinatorBuilder serializeCombinator( |
| @@ -582,35 +619,6 @@ 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) { |
| - 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 |