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

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

Issue 1685713002: Rework UnlinkedPublicName.constMembers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:analyzer/src/summary/format.dart'; 5 import 'package:analyzer/src/summary/format.dart';
6 import 'package:analyzer/src/summary/idl.dart'; 6 import 'package:analyzer/src/summary/idl.dart';
7 import 'package:analyzer/src/summary/name_filter.dart'; 7 import 'package:analyzer/src/summary/name_filter.dart';
8 8
9 /** 9 /**
10 * Create a [LinkedLibraryBuilder] corresponding to the given 10 * Create a [LinkedLibraryBuilder] corresponding to the given
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 for (int unitNum = 0; unitNum < unitUris.length; unitNum++) { 187 for (int unitNum = 0; unitNum < unitUris.length; unitNum++) {
188 String unitUri = unitUris[unitNum]; 188 String unitUri = unitUris[unitNum];
189 UnlinkedPublicNamespace importedNamespace = getImportCached(unitUri); 189 UnlinkedPublicNamespace importedNamespace = getImportCached(unitUri);
190 if (importedNamespace == null) { 190 if (importedNamespace == null) {
191 continue; 191 continue;
192 } 192 }
193 for (UnlinkedPublicName name in importedNamespace.names) { 193 for (UnlinkedPublicName name in importedNamespace.names) {
194 aggregated.putIfAbsent(name.name, () { 194 aggregated.putIfAbsent(name.name, () {
195 if (name.kind == ReferenceKind.classOrEnum) { 195 if (name.kind == ReferenceKind.classOrEnum) {
196 Map<String, _Meaning> namespace = <String, _Meaning>{}; 196 Map<String, _Meaning> namespace = <String, _Meaning>{};
197 name.constMembers.forEach((executable) { 197 name.members.forEach((executable) {
198 namespace[executable.name] = new _Meaning(unitNum, 198 namespace[executable.name] = new _Meaning(
199 executable.kind, 0, executable.numTypeParameters); 199 unitNum, executable.kind, 0, executable.numTypeParameters);
200 }); 200 });
201 return new _ClassMeaning( 201 return new _ClassMeaning(
202 unitNum, dependency, name.numTypeParameters, namespace); 202 unitNum, dependency, name.numTypeParameters, namespace);
203 } 203 }
204 return new _Meaning( 204 return new _Meaning(
205 unitNum, name.kind, dependency, name.numTypeParameters); 205 unitNum, name.kind, dependency, name.numTypeParameters);
206 }); 206 });
207 } 207 }
208 } 208 }
209 209
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 privateNamespace.putIfAbsent(cls.name, () { 260 privateNamespace.putIfAbsent(cls.name, () {
261 Map<String, _Meaning> namespace = <String, _Meaning>{}; 261 Map<String, _Meaning> namespace = <String, _Meaning>{};
262 cls.fields.forEach((field) { 262 cls.fields.forEach((field) {
263 if (field.isStatic && field.isConst) { 263 if (field.isStatic && field.isConst) {
264 namespace[field.name] = 264 namespace[field.name] =
265 new _Meaning(unitNum, ReferenceKind.propertyAccessor, 0, 0); 265 new _Meaning(unitNum, ReferenceKind.propertyAccessor, 0, 0);
266 } 266 }
267 }); 267 });
268 cls.executables.forEach((executable) { 268 cls.executables.forEach((executable) {
269 ReferenceKind kind = null; 269 ReferenceKind kind = null;
270 if (executable.kind == UnlinkedExecutableKind.constructor && 270 if (executable.kind == UnlinkedExecutableKind.constructor) {
271 executable.isConst) {
272 kind = ReferenceKind.constructor; 271 kind = ReferenceKind.constructor;
273 } else if (executable.kind == 272 } else if (executable.kind ==
274 UnlinkedExecutableKind.functionOrMethod && 273 UnlinkedExecutableKind.functionOrMethod &&
275 executable.isStatic) { 274 executable.isStatic) {
276 kind = ReferenceKind.method; 275 kind = ReferenceKind.method;
277 } 276 }
278 if (kind != null) { 277 if (kind != null && executable.name.isNotEmpty) {
279 namespace[executable.name] = new _Meaning( 278 namespace[executable.name] = new _Meaning(
280 unitNum, kind, 0, executable.typeParameters.length); 279 unitNum, kind, 0, executable.typeParameters.length);
281 } 280 }
282 }); 281 });
283 return new _ClassMeaning( 282 return new _ClassMeaning(
284 unitNum, 0, cls.typeParameters.length, namespace); 283 unitNum, 0, cls.typeParameters.length, namespace);
285 }); 284 });
286 } 285 }
287 for (UnlinkedEnum enm in unit.enums) { 286 for (UnlinkedEnum enm in unit.enums) {
288 privateNamespace.putIfAbsent(enm.name, 287 privateNamespace.putIfAbsent(enm.name,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 * [sourceUri] is also relative. 499 * [sourceUri] is also relative.
501 */ 500 */
502 String resolveUri(String sourceUri, String relativeUri) { 501 String resolveUri(String sourceUri, String relativeUri) {
503 if (sourceUri == null) { 502 if (sourceUri == null) {
504 return relativeUri; 503 return relativeUri;
505 } else { 504 } else {
506 return Uri.parse(sourceUri).resolve(relativeUri).toString(); 505 return Uri.parse(sourceUri).resolve(relativeUri).toString();
507 } 506 }
508 } 507 }
509 } 508 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/public_namespace_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698