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

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

Issue 1639533003: Record static constant public fields. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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 6ee90eb7b886118ff079de94c177d55b541143ef..5466f15f5e65d92d11035dedffce5f3ec7c10d85 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -1066,43 +1066,15 @@ class E {}
expect(unlinkedUnits[0].publicNamespace.names[0].numTypeParameters, 0);
}
- test_class_documented() {
- String text = '''
-// Extra comment so doc comment offset != 0
-/**
- * Docs
- */
-class C {}''';
- UnlinkedClass cls = serializeClassText(text);
- expect(cls.documentationComment, isNotNull);
- checkDocumentationComment(cls.documentationComment, text);
- }
-
- test_class_documented_with_references() {
- String text = '''
-// Extra comment so doc comment offset != 0
-/**
- * Docs referring to [D] and [E]
- */
-class C {}
-
-class D {}
-class E {}''';
- UnlinkedClass cls = serializeClassText(text);
- expect(cls.documentationComment, isNotNull);
- checkDocumentationComment(cls.documentationComment, text);
- }
-
- test_class_documented_with_with_windows_line_endings() {
- String text = '/**\r\n * Docs\r\n */\r\nclass C {}';
- UnlinkedClass cls = serializeClassText(text);
- expect(cls.documentationComment, isNotNull);
- checkDocumentationComment(cls.documentationComment, text);
- }
-
- test_class_executables() {
+ test_class_constMembers() {
UnlinkedClass cls = serializeClassText('''
class C {
+ int fieldInstance = 0;
+ final int fieldInstanceFinal = 0;
+ static int fieldStatic = 0;
+ static final int fieldStaticFinal = 0;
+ static const int fieldStaticConst = 0;
+ static const int _fieldStaticConstPrivate = 0;
static void methodStaticPublic() {}
static void _methodStaticPrivate() {}
C();
@@ -1121,25 +1093,64 @@ class C {
// executables
Map<String, UnlinkedPublicName> executablesMap =
<String, UnlinkedPublicName>{};
- className.executables.forEach((e) => executablesMap[e.name] = e);
- expect(executablesMap, hasLength(3));
+ className.constMembers.forEach((e) => executablesMap[e.name] = e);
+ expect(executablesMap, hasLength(4));
+ {
+ UnlinkedPublicName executable = executablesMap['fieldStaticConst'];
+ expect(executable.kind, ReferenceKind.constField);
+ expect(executable.constMembers, isEmpty);
+ }
{
UnlinkedPublicName executable = executablesMap['methodStaticPublic'];
expect(executable.kind, ReferenceKind.staticMethod);
- expect(executable.executables, isEmpty);
+ expect(executable.constMembers, isEmpty);
}
{
UnlinkedPublicName executable = executablesMap[''];
expect(executable.kind, ReferenceKind.constructor);
- expect(executable.executables, isEmpty);
+ expect(executable.constMembers, isEmpty);
}
{
UnlinkedPublicName executable = executablesMap['constructorNamedPublic'];
expect(executable.kind, ReferenceKind.constructor);
- expect(executable.executables, isEmpty);
+ expect(executable.constMembers, isEmpty);
}
}
+ test_class_documented() {
+ String text = '''
+// Extra comment so doc comment offset != 0
+/**
+ * Docs
+ */
+class C {}''';
+ UnlinkedClass cls = serializeClassText(text);
+ expect(cls.documentationComment, isNotNull);
+ checkDocumentationComment(cls.documentationComment, text);
+ }
+
+ test_class_documented_with_references() {
+ String text = '''
+// Extra comment so doc comment offset != 0
+/**
+ * Docs referring to [D] and [E]
+ */
+class C {}
+
+class D {}
+class E {}''';
+ UnlinkedClass cls = serializeClassText(text);
+ expect(cls.documentationComment, isNotNull);
+ checkDocumentationComment(cls.documentationComment, text);
+ }
+
+ test_class_documented_with_with_windows_line_endings() {
+ String text = '/**\r\n * Docs\r\n */\r\nclass C {}';
+ UnlinkedClass cls = serializeClassText(text);
+ expect(cls.documentationComment, isNotNull);
+ checkDocumentationComment(cls.documentationComment, text);
+ }
+
test_class_interface() {
UnlinkedClass cls = serializeClassText('''
class C implements D {}

Powered by Google App Engine
This is Rietveld 408576698