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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 2330813002: Reapply abc5051854fd7c98c7ba6b593211e47dcbcec9e8: Remove 'Element.docRange'. (Closed)
Patch Set: Created 4 years, 3 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/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 7f471233210a3d97bbb2560c32663426dfd8c4ab..e52d5a4f5cb77f18ed2da8056b3be0ad7e48c10e 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -737,7 +737,6 @@ class C {
expect(type.isMixinApplication, isFalse);
expect(type.isSynthetic, isFalse);
expect(type.documentationComment, '/// aaa');
- _assertHasDocRange(type, 50, 7);
_assertHasCodeRange(type, 50, 31);
}
@@ -1004,7 +1003,6 @@ class C {
expect(constructor, isNotNull);
_assertHasCodeRange(constructor, 50, 31);
expect(constructor.documentationComment, '/// aaa');
- _assertHasDocRange(constructor, 50, 7);
expect(constructor.isExternal, isFalse);
expect(constructor.isFactory, isFalse);
expect(constructor.name, "");
@@ -1207,7 +1205,6 @@ class C {
expect(enumElement, isNotNull);
_assertHasCodeRange(enumElement, 50, 31);
expect(enumElement.documentationComment, '/// aaa');
- _assertHasDocRange(enumElement, 50, 7);
expect(enumElement.name, enumName);
}
@@ -1233,7 +1230,6 @@ class C {
expect(firstField, isNotNull);
_assertHasCodeRange(firstField, 50, 61);
expect(firstField.documentationComment, '/// aaa');
- _assertHasDocRange(firstField, 50, 7);
expect(firstField.name, firstFieldName);
expect(firstField.initializer, isNull);
expect(firstField.isConst, isFalse);
@@ -1244,7 +1240,6 @@ class C {
expect(secondField, isNotNull);
_assertHasCodeRange(secondField, 50, 61);
expect(secondField.documentationComment, '/// aaa');
- _assertHasDocRange(secondField, 50, 7);
expect(secondField.name, secondFieldName);
expect(secondField.initializer, isNull);
expect(secondField.isConst, isFalse);
@@ -1365,7 +1360,6 @@ class C {
expect(accessor, isNotNull);
_assertHasCodeRange(accessor, 50, 31);
expect(accessor.documentationComment, '/// aaa');
- _assertHasDocRange(accessor, 50, 7);
expect(accessor.name, functionName);
expect(declaration.element, same(accessor));
expect(declaration.functionExpression.element, same(accessor));
@@ -1403,7 +1397,6 @@ class C {
expect(function, isNotNull);
_assertHasCodeRange(function, 50, 31);
expect(function.documentationComment, '/// aaa');
- _assertHasDocRange(function, 50, 7);
expect(function.hasImplicitReturnType, isFalse);
expect(function.name, functionName);
expect(declaration.element, same(function));
@@ -1435,7 +1428,6 @@ class C {
expect(accessor, isNotNull);
_assertHasCodeRange(accessor, 50, 31);
expect(accessor.documentationComment, '/// aaa');
- _assertHasDocRange(accessor, 50, 7);
expect(accessor.hasImplicitReturnType, isTrue);
expect(accessor.name, "$functionName=");
expect(declaration.element, same(accessor));
@@ -1516,7 +1508,6 @@ class C {
expect(alias, isNotNull);
_assertHasCodeRange(alias, 50, 31);
expect(alias.documentationComment, '/// aaa');
- _assertHasDocRange(alias, 50, 7);
expect(alias.name, aliasName);
expect(alias.parameters, hasLength(0));
List<TypeParameterElement> typeParameters = alias.typeParameters;
@@ -1717,7 +1708,6 @@ class A {
expect(getter, isNotNull);
_assertHasCodeRange(getter, 50, 31);
expect(getter.documentationComment, '/// aaa');
- _assertHasDocRange(getter, 50, 7);
expect(getter.hasImplicitReturnType, isTrue);
expect(getter.isAbstract, isFalse);
expect(getter.isExternal, isFalse);
@@ -1830,7 +1820,6 @@ class A {
expect(method, isNotNull);
_assertHasCodeRange(method, 50, 31);
expect(method.documentationComment, '/// aaa');
- _assertHasDocRange(method, 50, 7);
expect(method.hasImplicitReturnType, isFalse);
expect(method.name, methodName);
expect(method.functions, hasLength(0));
@@ -1907,7 +1896,6 @@ class A {
expect(setter, isNotNull);
_assertHasCodeRange(setter, 50, 31);
expect(setter.documentationComment, '/// aaa');
- _assertHasDocRange(setter, 50, 7);
expect(setter.hasImplicitReturnType, isTrue);
expect(setter.isAbstract, isFalse);
expect(setter.isExternal, isFalse);
@@ -2496,33 +2484,7 @@ class A {
expect(variable.setter, isNotNull);
}
- void test_visitVariableDeclaration_top_const_hasInitializer() {
- // const v = 42;
- ElementHolder holder = new ElementHolder();
- ElementBuilder builder = _makeBuilder(holder);
- String variableName = "v";
- VariableDeclaration variableDeclaration =
- AstFactory.variableDeclaration2(variableName, AstFactory.integer(42));
- AstFactory.variableDeclarationList2(Keyword.CONST, [variableDeclaration]);
- variableDeclaration.accept(builder);
-
- List<TopLevelVariableElement> variables = holder.topLevelVariables;
- expect(variables, hasLength(1));
- TopLevelVariableElement variable = variables[0];
- expect(variable, new isInstanceOf<ConstTopLevelVariableElementImpl>());
- expect(variable.initializer, isNotNull);
- expect(variable.initializer.type, isNotNull);
- expect(variable.initializer.hasImplicitReturnType, isTrue);
- expect(variable.name, variableName);
- expect(variable.hasImplicitType, isTrue);
- expect(variable.isConst, isTrue);
- expect(variable.isFinal, isFalse);
- expect(variable.isSynthetic, isFalse);
- expect(variable.getter, isNotNull);
- expect(variable.setter, isNull);
- }
-
- void test_visitVariableDeclaration_top_docRange() {
+ void test_visitVariableDeclaration_top() {
// final a, b;
ElementHolder holder = new ElementHolder();
ElementBuilder builder = _makeBuilder(holder);
@@ -2544,12 +2506,36 @@ class A {
TopLevelVariableElement variable1 = variables[0];
expect(variable1, isNotNull);
expect(variable1.documentationComment, '/// aaa');
- _assertHasDocRange(variable1, 50, 7);
TopLevelVariableElement variable2 = variables[1];
expect(variable2, isNotNull);
expect(variable2.documentationComment, '/// aaa');
- _assertHasDocRange(variable2, 50, 7);
+ }
+
+ void test_visitVariableDeclaration_top_const_hasInitializer() {
+ // const v = 42;
+ ElementHolder holder = new ElementHolder();
+ ElementBuilder builder = _makeBuilder(holder);
+ String variableName = "v";
+ VariableDeclaration variableDeclaration =
+ AstFactory.variableDeclaration2(variableName, AstFactory.integer(42));
+ AstFactory.variableDeclarationList2(Keyword.CONST, [variableDeclaration]);
+ variableDeclaration.accept(builder);
+
+ List<TopLevelVariableElement> variables = holder.topLevelVariables;
+ expect(variables, hasLength(1));
+ TopLevelVariableElement variable = variables[0];
+ expect(variable, new isInstanceOf<ConstTopLevelVariableElementImpl>());
+ expect(variable.initializer, isNotNull);
+ expect(variable.initializer.type, isNotNull);
+ expect(variable.initializer.hasImplicitReturnType, isTrue);
+ expect(variable.name, variableName);
+ expect(variable.hasImplicitType, isTrue);
+ expect(variable.isConst, isTrue);
+ expect(variable.isFinal, isFalse);
+ expect(variable.isSynthetic, isFalse);
+ expect(variable.getter, isNotNull);
+ expect(variable.setter, isNull);
}
void test_visitVariableDeclaration_top_final() {
@@ -2581,15 +2567,6 @@ class A {
expect(elementImpl.codeLength, length);
}
- void _assertHasDocRange(
- Element element, int expectedOffset, int expectedLength) {
- // Cast to dynamic here to avoid a hint about @deprecated docRange.
- SourceRange docRange = (element as dynamic).docRange;
- expect(docRange, isNotNull);
- expect(docRange.offset, expectedOffset);
- expect(docRange.length, expectedLength);
- }
-
void _assertVisibleRange(LocalElement element, int offset, int end) {
SourceRange visibleRange = element.visibleRange;
expect(visibleRange.offset, offset);
@@ -3136,8 +3113,6 @@ class EnumMemberBuilderTest extends EngineTestCase {
expect(constant.isStatic, isTrue);
expect((constant as FieldElementImpl).evaluationResult, isNotNull);
expect(constant.documentationComment, '/// aaa');
- expect(constant.docRange.offset, 50);
- expect(constant.docRange.length, 7);
_assertGetter(constant);
}
@@ -4146,7 +4121,7 @@ void f() {
_assertNthStatementDoesNotExit(source, 0);
}
- void test_whileStatement_breakWithLabel_afterExting() {
+ void test_whileStatement_breakWithLabel_afterExiting() {
Source source = addSource(r'''
void f() {
x: while (true) {

Powered by Google App Engine
This is Rietveld 408576698