| Index: pkg/analyzer/test/src/task/incremental_element_builder_test.dart
|
| diff --git a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
|
| index 3761bb6e431c85d67d017a0a4587f53efb03943c..99bc6aad11c6f00df2b03fc59b9913c58cfbe20b 100644
|
| --- a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
|
| +++ b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
|
| @@ -1649,6 +1649,18 @@ class A {
|
| ''');
|
| }
|
|
|
| + test_update_annotation_add() {
|
| + _buildOldUnit(r'''
|
| +const myAnnotation = const Object();
|
| +foo() {}
|
| +''');
|
| + _buildNewUnit(r'''
|
| +const myAnnotation = const Object();
|
| +@myAnnotation
|
| +foo() {}
|
| +''');
|
| + }
|
| +
|
| test_update_beforeClassWithDelta_nameOffset() {
|
| _buildOldUnit(r'''
|
| class A {}
|
| @@ -1866,6 +1878,16 @@ class _BuiltElementsValidator extends AstComparator {
|
| actual.getAncestor((n) => n is ClassDeclaration);
|
| expect(element.enclosingElement, same(classNode.element));
|
| }
|
| + // ElementAnnotationImpl must use the enclosing CompilationUnitElement.
|
| + if (actual is Annotation) {
|
| + AstNode parent = actual.parent;
|
| + if (parent is Declaration) {
|
| + ElementAnnotationImpl actualElement = actual.elementAnnotation;
|
| + CompilationUnitElement enclosingUnitElement =
|
| + parent.element.getAncestor((a) => a is CompilationUnitElement);
|
| + expect(actualElement.compilationUnit, same(enclosingUnitElement));
|
| + }
|
| + }
|
| // Identifiers like 'a.b' in 'new a.b()' might be rewritten if resolver
|
| // sees that 'a' is actually a class name, so 'b' is a constructor name.
|
| //
|
|
|