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

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

Issue 1646363002: Rename ReferenceKind.constField and referenceKind.staticMethod. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unintentional deletion 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) 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 serialization.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/dart/element/type.dart'; 10 import 'package:analyzer/src/dart/element/type.dart';
(...skipping 22 matching lines...) Expand all
33 element is DynamicElementImpl) { 33 element is DynamicElementImpl) {
34 return ReferenceKind.classOrEnum; 34 return ReferenceKind.classOrEnum;
35 } else if (element is ConstructorElement) { 35 } else if (element is ConstructorElement) {
36 return ReferenceKind.constructor; 36 return ReferenceKind.constructor;
37 } else if (element is FunctionElement) { 37 } else if (element is FunctionElement) {
38 return ReferenceKind.topLevelFunction; 38 return ReferenceKind.topLevelFunction;
39 } else if (element is FunctionTypeAliasElement) { 39 } else if (element is FunctionTypeAliasElement) {
40 return ReferenceKind.typedef; 40 return ReferenceKind.typedef;
41 } else if (element is PropertyAccessorElement) { 41 } else if (element is PropertyAccessorElement) {
42 if (element.enclosingElement is ClassElement) { 42 if (element.enclosingElement is ClassElement) {
43 return ReferenceKind.constField; 43 return ReferenceKind.propertyAccessor;
44 } 44 }
45 return ReferenceKind.topLevelPropertyAccessor; 45 return ReferenceKind.topLevelPropertyAccessor;
46 } else if (element is MethodElement) { 46 } else if (element is MethodElement) {
47 return ReferenceKind.staticMethod; 47 return ReferenceKind.method;
48 } else { 48 } else {
49 throw new Exception('Unexpected element kind: ${element.runtimeType}'); 49 throw new Exception('Unexpected element kind: ${element.runtimeType}');
50 } 50 }
51 } 51 }
52 52
53 /** 53 /**
54 * Type of closures used by [_LibrarySerializer] to defer generation of 54 * Type of closures used by [_LibrarySerializer] to defer generation of
55 * [EntityRefBuilder] objects until the end of serialization of a 55 * [EntityRefBuilder] objects until the end of serialization of a
56 * compilation unit. 56 * compilation unit.
57 */ 57 */
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 * constants - static constant fields, static methods and constructors. 383 * constants - static constant fields, static methods and constructors.
384 * Otherwise return `null`. 384 * Otherwise return `null`.
385 */ 385 */
386 List<UnlinkedPublicNameBuilder> serializeClassConstMembers(ClassElement cls) { 386 List<UnlinkedPublicNameBuilder> serializeClassConstMembers(ClassElement cls) {
387 if (cls.kind == ElementKind.CLASS) { 387 if (cls.kind == ElementKind.CLASS) {
388 List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[]; 388 List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[];
389 for (FieldElement field in cls.fields) { 389 for (FieldElement field in cls.fields) {
390 if (field.isStatic && field.isConst && field.isPublic) { 390 if (field.isStatic && field.isConst && field.isPublic) {
391 bs.add(new UnlinkedPublicNameBuilder( 391 bs.add(new UnlinkedPublicNameBuilder(
392 name: field.name, 392 name: field.name,
393 kind: ReferenceKind.constField, 393 kind: ReferenceKind.propertyAccessor,
394 numTypeParameters: 0)); 394 numTypeParameters: 0));
395 } 395 }
396 } 396 }
397 for (MethodElement method in cls.methods) { 397 for (MethodElement method in cls.methods) {
398 if (method.isStatic && method.isPublic) { 398 if (method.isStatic && method.isPublic) {
399 bs.add(new UnlinkedPublicNameBuilder( 399 bs.add(new UnlinkedPublicNameBuilder(
400 name: method.name, 400 name: method.name,
401 kind: ReferenceKind.staticMethod, 401 kind: ReferenceKind.method,
402 numTypeParameters: method.typeParameters.length)); 402 numTypeParameters: method.typeParameters.length));
403 } 403 }
404 } 404 }
405 for (ConstructorElement constructor in cls.constructors) { 405 for (ConstructorElement constructor in cls.constructors) {
406 if (constructor.isConst && constructor.isPublic) { 406 if (constructor.isConst && constructor.isPublic) {
407 bs.add(new UnlinkedPublicNameBuilder( 407 bs.add(new UnlinkedPublicNameBuilder(
408 name: constructor.name, 408 name: constructor.name,
409 kind: ReferenceKind.constructor, 409 kind: ReferenceKind.constructor,
410 numTypeParameters: 0)); 410 numTypeParameters: 0));
411 } 411 }
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 exportNames.add(new LinkedExportNameBuilder( 1117 exportNames.add(new LinkedExportNameBuilder(
1118 name: name, 1118 name: name,
1119 dependency: serializeDependency(dependentLibrary), 1119 dependency: serializeDependency(dependentLibrary),
1120 unit: unit, 1120 unit: unit,
1121 kind: kind)); 1121 kind: kind));
1122 } 1122 }
1123 pb.exportNames = exportNames; 1123 pb.exportNames = exportNames;
1124 return pb; 1124 return pb;
1125 } 1125 }
1126 } 1126 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698