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

Side by Side Diff: pkg/analyzer/lib/src/summary/public_namespace_computer.dart

Issue 1841433002: Fix summary handling of enum values. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 @override 111 @override
112 visitClassTypeAlias(ClassTypeAlias node) { 112 visitClassTypeAlias(ClassTypeAlias node) {
113 addNameIfPublic(node.name.name, ReferenceKind.classOrEnum, 113 addNameIfPublic(node.name.name, ReferenceKind.classOrEnum,
114 node.typeParameters?.typeParameters?.length ?? 0); 114 node.typeParameters?.typeParameters?.length ?? 0);
115 } 115 }
116 116
117 @override 117 @override
118 visitEnumDeclaration(EnumDeclaration node) { 118 visitEnumDeclaration(EnumDeclaration node) {
119 addNameIfPublic(node.name.name, ReferenceKind.classOrEnum, 0); 119 UnlinkedPublicNameBuilder enm =
120 addNameIfPublic(node.name.name, ReferenceKind.classOrEnum, 0);
121 if (enm != null) {
122 enm.members.add(new UnlinkedPublicNameBuilder(
123 name: 'values',
124 kind: ReferenceKind.propertyAccessor,
125 numTypeParameters: 0));
126 for (EnumConstantDeclaration enumConstant in node.constants) {
127 String name = enumConstant.name.name;
128 if (isPublic(name)) {
129 enm.members.add(new UnlinkedPublicNameBuilder(
130 name: name,
131 kind: ReferenceKind.propertyAccessor,
132 numTypeParameters: 0));
133 }
134 }
135 }
120 } 136 }
121 137
122 @override 138 @override
123 visitExportDirective(ExportDirective node) { 139 visitExportDirective(ExportDirective node) {
124 exports.add(new UnlinkedExportPublicBuilder( 140 exports.add(new UnlinkedExportPublicBuilder(
125 uri: node.uri.stringValue, 141 uri: node.uri.stringValue,
126 combinators: node.combinators 142 combinators: node.combinators
127 .map((Combinator c) => c.accept(new _CombinatorEncoder())) 143 .map((Combinator c) => c.accept(new _CombinatorEncoder()))
128 .toList())); 144 .toList()));
129 } 145 }
(...skipping 25 matching lines...) Expand all
155 171
156 @override 172 @override
157 visitVariableDeclaration(VariableDeclaration node) { 173 visitVariableDeclaration(VariableDeclaration node) {
158 String name = node.name.name; 174 String name = node.name.name;
159 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0); 175 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0);
160 if (!node.isFinal && !node.isConst) { 176 if (!node.isFinal && !node.isConst) {
161 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0); 177 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0);
162 } 178 }
163 } 179 }
164 } 180 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/prelink.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698