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

Unified Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1944023002: Include all static class members in UnlinkedPublicName.members. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix incorrect upload (previously included changes from CL 1944773002) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 7e25284ce2a6d88067c86da4d01041b8bc64caa8..1ee59a8e0a6e6339c6d9634d60a489bd2adabe37 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -43,7 +43,8 @@ Object canonicalize(Object obj, {bool orderByName: false}) {
Map<String, Object> result = <String, Object>{};
obj.toMap().forEach((String key, Object value) {
bool orderByName = false;
- if (obj is UnlinkedPublicNamespace && key == 'names') {
+ if (obj is UnlinkedPublicNamespace && key == 'names' ||
+ obj is UnlinkedPublicName && key == 'members') {
orderByName = true;
}
result[key] = canonicalize(value, orderByName: orderByName);
@@ -1156,17 +1157,19 @@ class C {
Map<String, UnlinkedPublicName> executablesMap =
<String, UnlinkedPublicName>{};
className.members.forEach((e) => executablesMap[e.name] = e);
- expect(executablesMap, hasLength(2));
- {
- UnlinkedPublicName executable = executablesMap['fieldStaticConst'];
- expect(executable.kind, ReferenceKind.propertyAccessor);
- expect(executable.members, isEmpty);
- }
- {
- UnlinkedPublicName executable = executablesMap['methodStaticPublic'];
- expect(executable.kind, ReferenceKind.method);
+ expect(executablesMap, hasLength(4));
+ Map<String, ReferenceKind> expectedExecutableKinds =
+ <String, ReferenceKind>{
+ 'fieldStaticConst': ReferenceKind.propertyAccessor,
+ 'fieldStaticFinal': ReferenceKind.propertyAccessor,
+ 'fieldStatic': ReferenceKind.propertyAccessor,
+ 'methodStaticPublic': ReferenceKind.method,
+ };
+ expectedExecutableKinds.forEach((String name, ReferenceKind expectedKind) {
+ UnlinkedPublicName executable = executablesMap[name];
+ expect(executable.kind, expectedKind);
expect(executable.members, isEmpty);
- }
+ });
}
test_class_constMembers_constructors() {
@@ -6946,6 +6949,9 @@ final v = 42 is num;
expect(variable.constExpr, isNull);
expect(findExecutable('i', executables: cls.executables), isNull);
expect(findExecutable('i=', executables: cls.executables), isNull);
+ expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members, isEmpty);
}
test_field_const() {
@@ -7096,6 +7102,17 @@ class C<T> {
serializeClassText('class C { static int i; }').fields[0];
expect(variable.isStatic, isTrue);
expect(variable.constExpr, isNull);
+ expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].members[0].name, 'i');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members[0].kind,
+ ReferenceKind.propertyAccessor);
+ expect(
+ unlinkedUnits[0].publicNamespace.names[0].members[0].numTypeParameters,
+ 0);
+ expect(
+ unlinkedUnits[0].publicNamespace.names[0].members[0].members, isEmpty);
}
test_field_static_final() {
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698