Analyzer test cleanup: remove unnecessary getter includeInformative
This getter appears to have been introduced in anticipation of
refactoring the summary mechanism to avoid populating summaries with
unnecessary "informative" data (see
da6a26966e917f11b5d423edc8f6c7d1e451c20a), but such a refactoring
never occurred.
Change-Id: I6c486b21864b22a943af546a76bd63f7d55c42a3
Reviewed-on: https://dart-review.googlesource.com/71427
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index d0e28b5..980639d 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -138,13 +138,6 @@
LinkedUnit get definingUnit => linked.units[0];
/**
- * Whether the parts of the IDL marked `@informative` are expected to be
- * included in the generated summary; if `false`, these parts of the IDL won't
- * be checked.
- */
- bool get includeInformative => true;
-
- /**
* Get access to the linked summary that results from serializing and
* then deserializing the library under test.
*/
@@ -1123,7 +1116,6 @@
}
test_class_alias_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -1201,7 +1193,6 @@
}
test_class_codeRange() {
- if (!includeInformative) return;
UnlinkedClass cls = serializeClassText(' class C {}');
_assertCodeRange(cls.codeRange, 1, 10);
}
@@ -1290,7 +1281,6 @@
}
test_class_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -1303,7 +1293,6 @@
}
test_class_documented_tripleSlash() {
- if (!includeInformative) return;
String text = '''
/// aaa
/// bbbb
@@ -1316,7 +1305,6 @@
}
test_class_documented_with_references() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -1332,7 +1320,6 @@
}
test_class_documented_with_with_windows_line_endings() {
- if (!includeInformative) return;
String text = '/**\r\n * Docs\r\n */\r\nclass C {}';
UnlinkedClass cls = serializeClassText(text);
expect(cls.documentationComment, isNotNull);
@@ -1383,9 +1370,7 @@
var classText = 'class C {}';
UnlinkedClass cls = serializeClassText(classText);
expect(cls.name, 'C');
- if (includeInformative) {
- expect(cls.nameOffset, classText.indexOf('C'));
- }
+ expect(cls.nameOffset, classText.indexOf('C'));
}
test_class_no_flags() {
@@ -1474,9 +1459,7 @@
UnlinkedClass cls = serializeClassText(text);
expect(cls.typeParameters, hasLength(1));
expect(cls.typeParameters[0].name, 'T');
- if (includeInformative) {
- expect(cls.typeParameters[0].nameOffset, text.indexOf('T'));
- }
+ expect(cls.typeParameters[0].nameOffset, text.indexOf('T'));
expect(cls.typeParameters[0].bound, isNull);
expect(unlinkedUnits[0].publicNamespace.names[0].numTypeParameters, 1);
}
@@ -3481,19 +3464,14 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- expect(executable.nameOffset, text.indexOf('C();'));
- expect(executable.periodOffset, 0);
- expect(executable.nameEnd, 0);
- }
+ expect(executable.nameOffset, text.indexOf('C();'));
+ expect(executable.periodOffset, 0);
+ expect(executable.nameEnd, 0);
expect(executable.isRedirectedConstructor, isFalse);
expect(executable.redirectedConstructor, isNull);
expect(executable.redirectedConstructorName, isEmpty);
-
- if (includeInformative) {
- expect(executable.visibleOffset, 0);
- expect(executable.visibleLength, 0);
- }
+ expect(executable.visibleOffset, 0);
+ expect(executable.visibleLength, 0);
}
test_constructor_anonymous() {
@@ -3518,7 +3496,6 @@
}
test_constructor_documented() {
- if (!includeInformative) return;
String text = '''
class C {
/**
@@ -3919,9 +3896,7 @@
expect(parameter.kind, UnlinkedParamKind.named);
expect(parameter.initializer, isNotNull);
expect(parameter.defaultValueCode, '42');
- if (includeInformative) {
- _assertCodeRange(parameter.codeRange, 13, 10);
- }
+ _assertCodeRange(parameter.codeRange, 13, 10);
assertUnlinkedConst(parameter.initializer.bodyExpr,
operators: [UnlinkedExprOperation.pushInt], ints: [42]);
}
@@ -3953,9 +3928,7 @@
expect(parameter.kind, UnlinkedParamKind.positional);
expect(parameter.initializer, isNotNull);
expect(parameter.defaultValueCode, '42');
- if (includeInformative) {
- _assertCodeRange(parameter.codeRange, 13, 11);
- }
+ _assertCodeRange(parameter.codeRange, 13, 11);
assertUnlinkedConst(parameter.initializer.bodyExpr,
operators: [UnlinkedExprOperation.pushInt], ints: [42]);
}
@@ -3997,12 +3970,10 @@
UnlinkedExecutable executable = findExecutable('foo',
executables: serializeClassText(text).executables);
expect(executable.name, 'foo');
- if (includeInformative) {
- expect(executable.nameOffset, text.indexOf('foo'));
- expect(executable.periodOffset, text.indexOf('.foo'));
- expect(executable.nameEnd, text.indexOf('()'));
- _assertCodeRange(executable.codeRange, 10, 8);
- }
+ expect(executable.nameOffset, text.indexOf('foo'));
+ expect(executable.periodOffset, text.indexOf('.foo'));
+ expect(executable.nameEnd, text.indexOf('()'));
+ _assertCodeRange(executable.codeRange, 10, 8);
}
test_constructor_non_const() {
@@ -5043,15 +5014,11 @@
String text = 'enum E { v1 }';
UnlinkedEnum e = serializeEnumText(text);
expect(e.name, 'E');
- if (includeInformative) {
- expect(e.nameOffset, text.indexOf('E'));
- }
+ expect(e.nameOffset, text.indexOf('E'));
expect(e.values, hasLength(1));
expect(e.values[0].name, 'v1');
- if (includeInformative) {
- expect(e.values[0].nameOffset, text.indexOf('v1'));
- _assertCodeRange(e.codeRange, 0, 13);
- }
+ expect(e.values[0].nameOffset, text.indexOf('v1'));
+ _assertCodeRange(e.codeRange, 0, 13);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
expect(unlinkedUnits[0].publicNamespace.names[0].kind,
ReferenceKind.classOrEnum);
@@ -5073,7 +5040,6 @@
}
test_enum_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -5098,7 +5064,6 @@
}
test_enum_value_documented() {
- if (!includeInformative) return;
String text = '''
enum E {
/**
@@ -5138,11 +5103,9 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- expect(executable.nameOffset, text.indexOf('f'));
- expect(executable.visibleOffset, 0);
- expect(executable.visibleLength, 0);
- }
+ expect(executable.nameOffset, text.indexOf('f'));
+ expect(executable.visibleOffset, 0);
+ expect(executable.visibleLength, 0);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
expect(unlinkedUnits[0].publicNamespace.names[0].kind,
ReferenceKind.topLevelFunction);
@@ -5192,9 +5155,7 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- expect(executable.nameOffset, text.indexOf('f'));
- }
+ expect(executable.nameOffset, text.indexOf('f'));
expect(findVariable('f'), isNull);
expect(findExecutable('f='), isNull);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -5248,11 +5209,9 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- expect(executable.visibleOffset, 0);
- expect(executable.visibleLength, 0);
- _assertCodeRange(executable.codeRange, 10, 6);
- }
+ expect(executable.visibleOffset, 0);
+ expect(executable.visibleLength, 0);
+ _assertCodeRange(executable.codeRange, 10, 6);
}
test_executable_member_function_async() {
@@ -5303,9 +5262,7 @@
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
expect(executable.isStatic, isFalse);
- if (includeInformative) {
- _assertCodeRange(executable.codeRange, 10, 15);
- }
+ _assertCodeRange(executable.codeRange, 10, 15);
expect(findVariable('f', variables: cls.fields), isNull);
expect(findExecutable('f=', executables: cls.executables), isNull);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -5348,9 +5305,7 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- _assertCodeRange(executable.codeRange, 10, 20);
- }
+ _assertCodeRange(executable.codeRange, 10, 20);
expect(findVariable('f', variables: cls.fields), isNull);
expect(findExecutable('f', executables: cls.executables), isNull);
}
@@ -5488,7 +5443,6 @@
}
test_executable_param_codeRange() {
- if (!includeInformative) return;
UnlinkedExecutable executable = serializeExecutableText('f(int x) {}');
UnlinkedParam parameter = executable.parameters[0];
_assertCodeRange(parameter.codeRange, 2, 5);
@@ -5580,9 +5534,7 @@
expect(param.kind, UnlinkedParamKind.named);
expect(param.initializer, isNotNull);
expect(param.defaultValueCode, '42');
- if (includeInformative) {
- _assertCodeRange(param.codeRange, 3, 5);
- }
+ _assertCodeRange(param.codeRange, 3, 5);
assertUnlinkedConst(param.initializer.bodyExpr,
operators: [UnlinkedExprOperation.pushInt], ints: [42]);
}
@@ -5601,9 +5553,7 @@
expect(param.kind, UnlinkedParamKind.positional);
expect(param.initializer, isNotNull);
expect(param.defaultValueCode, '42');
- if (includeInformative) {
- _assertCodeRange(param.codeRange, 3, 6);
- }
+ _assertCodeRange(param.codeRange, 3, 6);
assertUnlinkedConst(param.initializer.bodyExpr,
operators: [UnlinkedExprOperation.pushInt], ints: [42]);
}
@@ -5621,9 +5571,7 @@
UnlinkedExecutable executable = serializeExecutableText(text);
expect(executable.parameters, hasLength(1));
expect(executable.parameters[0].name, 'x');
- if (includeInformative) {
- expect(executable.parameters[0].nameOffset, text.indexOf('x'));
- }
+ expect(executable.parameters[0].nameOffset, text.indexOf('x'));
}
test_executable_param_no_flags() {
@@ -5728,9 +5676,7 @@
expect(executable.isAsynchronous, isFalse);
expect(executable.isExternal, isFalse);
expect(executable.isGenerator, isFalse);
- if (includeInformative) {
- expect(executable.nameOffset, text.indexOf('f'));
- }
+ expect(executable.nameOffset, text.indexOf('f'));
expect(findVariable('f'), isNull);
expect(findExecutable('f'), isNull);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -5928,11 +5874,9 @@
'Future');
expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].hides[1],
'Stream');
- if (includeInformative) {
- expect(
- unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset, 0);
- expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end, 0);
- }
+ expect(
+ unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset, 0);
+ expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end, 0);
expect(linked.exportNames, isNotEmpty);
}
@@ -6047,12 +5991,10 @@
'Future');
expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].shows[1],
'Stream');
- if (includeInformative) {
- expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset,
- libraryText.indexOf('show'));
- expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end,
- libraryText.indexOf(';'));
- }
+ expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset,
+ libraryText.indexOf('show'));
+ expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end,
+ libraryText.indexOf(';'));
}
test_export_typedef() {
@@ -7261,7 +7203,6 @@
}
test_field_documented() {
- if (!includeInformative) return;
String text = '''
class C {
/**
@@ -7450,7 +7391,6 @@
}
test_function_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -7483,7 +7423,6 @@
}
test_getter_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -7592,10 +7531,8 @@
expect(unlinkedUnits[0].imports[0].combinators[0].hides, hasLength(2));
expect(unlinkedUnits[0].imports[0].combinators[0].hides[0], 'Future');
expect(unlinkedUnits[0].imports[0].combinators[0].hides[1], 'Stream');
- if (includeInformative) {
- expect(unlinkedUnits[0].imports[0].combinators[0].offset, 0);
- expect(unlinkedUnits[0].imports[0].combinators[0].end, 0);
- }
+ expect(unlinkedUnits[0].imports[0].combinators[0].offset, 0);
+ expect(unlinkedUnits[0].imports[0].combinators[0].end, 0);
}
test_import_implicit() {
@@ -7604,10 +7541,8 @@
expect(unlinkedUnits[0].imports, hasLength(1));
checkDependency(linked.importDependencies[0], 'dart:core');
expect(unlinkedUnits[0].imports[0].uri, isEmpty);
- if (includeInformative) {
- expect(unlinkedUnits[0].imports[0].uriOffset, 0);
- expect(unlinkedUnits[0].imports[0].uriEnd, 0);
- }
+ expect(unlinkedUnits[0].imports[0].uriOffset, 0);
+ expect(unlinkedUnits[0].imports[0].uriEnd, 0);
expect(unlinkedUnits[0].imports[0].prefixReference, 0);
expect(unlinkedUnits[0].imports[0].combinators, isEmpty);
expect(unlinkedUnits[0].imports[0].isImplicit, isTrue);
@@ -8189,7 +8124,6 @@
}
test_library_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -8798,7 +8732,6 @@
}
test_method_documented() {
- if (!includeInformative) return;
String text = '''
class C {
/**
@@ -9034,7 +8967,6 @@
}
test_setter_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -9258,7 +9190,6 @@
}
test_type_param_codeRange() {
- if (!includeInformative) return;
UnlinkedClass cls =
serializeClassText('class A {} class C<T extends A> {}');
UnlinkedTypeParam typeParameter = cls.typeParameters[0];
@@ -9503,13 +9434,11 @@
}
test_typedef_codeRange() {
- if (!includeInformative) return;
UnlinkedTypedef type = serializeTypedefText('typedef F();');
_assertCodeRange(type.codeRange, 0, 12);
}
test_typedef_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -9579,9 +9508,7 @@
String text = 'typedef F();';
UnlinkedTypedef type = serializeTypedefText(text);
expect(type.name, 'F');
- if (includeInformative) {
- expect(type.nameOffset, text.indexOf('F'));
- }
+ expect(type.nameOffset, text.indexOf('F'));
expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
expect(
unlinkedUnits[0].publicNamespace.names[0].kind, ReferenceKind.typedef);
@@ -9650,7 +9577,6 @@
}
test_unit_codeRange() {
- if (!includeInformative) return;
serializeLibraryText(' int a = 1; ');
UnlinkedUnit unit = unlinkedUnits[0];
_assertCodeRange(unit.codeRange, 0, 14);
@@ -9727,9 +9653,7 @@
test_variable() {
String text = 'int i;';
UnlinkedVariable v = serializeVariableText(text, variableName: 'i');
- if (includeInformative) {
- expect(v.nameOffset, text.indexOf('i;'));
- }
+ expect(v.nameOffset, text.indexOf('i;'));
expect(findExecutable('i'), isNull);
expect(findExecutable('i='), isNull);
expect(unlinkedUnits[0].publicNamespace.names, hasLength(2));
@@ -9744,7 +9668,6 @@
}
test_variable_codeRange() {
- if (!includeInformative) return;
serializeLibraryText(' int a = 1, b = 22;');
List<UnlinkedVariable> variables = unlinkedUnits[0].variables;
_assertCodeRange(variables[0].codeRange, 1, 9);
@@ -9758,7 +9681,6 @@
}
test_variable_documented() {
- if (!includeInformative) return;
String text = '''
// Extra comment so doc comment offset != 0
/**
@@ -9811,9 +9733,7 @@
UnlinkedVariable variable = serializeVariableText('var v = 42;');
UnlinkedExecutable initializer = variable.initializer;
expect(initializer, isNotNull);
- if (includeInformative) {
- expect(initializer.nameOffset, 8);
- }
+ expect(initializer.nameOffset, 8);
expect(initializer.name, isEmpty);
expect(initializer.localFunctions, isEmpty);
}
@@ -9829,38 +9749,28 @@
UnlinkedVariable variable = serializeVariableText(text);
UnlinkedExecutable initializer = variable.initializer;
expect(initializer, isNotNull);
- if (includeInformative) {
- expect(initializer.nameOffset, text.indexOf('<dynamic, dynamic>{"1'));
- }
+ expect(initializer.nameOffset, text.indexOf('<dynamic, dynamic>{"1'));
expect(initializer.name, isEmpty);
expect(initializer.localFunctions, hasLength(2));
// closure: () { f1() {} var v1; }
{
UnlinkedExecutable closure = initializer.localFunctions[0];
- if (includeInformative) {
- expect(closure.nameOffset, text.indexOf('() { f1()'));
- }
+ expect(closure.nameOffset, text.indexOf('() { f1()'));
expect(closure.name, isEmpty);
// closure - f1
expect(closure.localFunctions, hasLength(1));
expect(closure.localFunctions[0].name, 'f1');
- if (includeInformative) {
- expect(closure.localFunctions[0].nameOffset, text.indexOf('f1()'));
- }
+ expect(closure.localFunctions[0].nameOffset, text.indexOf('f1()'));
}
// closure: () { f2() {} var v2; }
{
UnlinkedExecutable closure = initializer.localFunctions[1];
- if (includeInformative) {
- expect(closure.nameOffset, text.indexOf('() { f2()'));
- }
+ expect(closure.nameOffset, text.indexOf('() { f2()'));
expect(closure.name, isEmpty);
// closure - f1
expect(closure.localFunctions, hasLength(1));
expect(closure.localFunctions[0].name, 'f2');
- if (includeInformative) {
- expect(closure.localFunctions[0].nameOffset, text.indexOf('f2()'));
- }
+ expect(closure.localFunctions[0].nameOffset, text.indexOf('f2()'));
}
}