| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.summary.public_namespace_visitor; | 5 library analyzer.src.summary.public_namespace_visitor; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/summary/format.dart'; | 8 import 'package:analyzer/src/summary/format.dart'; |
| 9 import 'package:analyzer/src/summary/idl.dart'; | 9 import 'package:analyzer/src/summary/idl.dart'; |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool isPublic(String name) => !name.startsWith('_'); | 61 bool isPublic(String name) => !name.startsWith('_'); |
| 62 | 62 |
| 63 @override | 63 @override |
| 64 visitClassDeclaration(ClassDeclaration node) { | 64 visitClassDeclaration(ClassDeclaration node) { |
| 65 UnlinkedPublicNameBuilder cls = addNameIfPublic( | 65 UnlinkedPublicNameBuilder cls = addNameIfPublic( |
| 66 node.name.name, | 66 node.name.name, |
| 67 ReferenceKind.classOrEnum, | 67 ReferenceKind.classOrEnum, |
| 68 node.typeParameters?.typeParameters?.length ?? 0); | 68 node.typeParameters?.typeParameters?.length ?? 0); |
| 69 if (cls != null) { | 69 if (cls != null) { |
| 70 for (ClassMember member in node.members) { | 70 for (ClassMember member in node.members) { |
| 71 if (member is FieldDeclaration && | 71 if (member is FieldDeclaration && member.isStatic) { |
| 72 member.isStatic && | |
| 73 member.fields.isConst) { | |
| 74 for (VariableDeclaration field in member.fields.variables) { | 72 for (VariableDeclaration field in member.fields.variables) { |
| 75 String name = field.name.name; | 73 String name = field.name.name; |
| 76 if (isPublic(name)) { | 74 if (isPublic(name)) { |
| 77 cls.members.add(new UnlinkedPublicNameBuilder( | 75 cls.members.add(new UnlinkedPublicNameBuilder( |
| 78 name: name, | 76 name: name, |
| 79 kind: ReferenceKind.propertyAccessor, | 77 kind: ReferenceKind.propertyAccessor, |
| 80 numTypeParameters: 0)); | 78 numTypeParameters: 0)); |
| 81 } | 79 } |
| 82 } | 80 } |
| 83 } | 81 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 170 |
| 173 @override | 171 @override |
| 174 visitVariableDeclaration(VariableDeclaration node) { | 172 visitVariableDeclaration(VariableDeclaration node) { |
| 175 String name = node.name.name; | 173 String name = node.name.name; |
| 176 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0); | 174 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0); |
| 177 if (!node.isFinal && !node.isConst) { | 175 if (!node.isFinal && !node.isConst) { |
| 178 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0); | 176 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0); |
| 179 } | 177 } |
| 180 } | 178 } |
| 181 } | 179 } |
| OLD | NEW |