| Index: pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| index a788b153cef78a16d7fd3dde140c7f5b911dad0c..faf79dd1a7fa6bf06be579d2f4046c108091bec0 100644
|
| --- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
|
| @@ -136,6 +136,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
|
| ClassElement element = _findElement(_enclosingUnit.types, name);
|
| _enclosingClass = element;
|
| _processElement(element);
|
| + _assertSameAnnotations(node, element);
|
| _assertSameTypeParameters(node.typeParameters, element.typeParameters);
|
| // check for missing clauses
|
| if (node.extendsClause == null) {
|
| @@ -264,6 +265,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
|
| }
|
| // process element
|
| _processElement(element);
|
| + _assertSameAnnotations(node, element);
|
| _assertFalse(element.isSynthetic);
|
| _assertSameType(node.returnType, element.returnType);
|
| _assertCompatibleParameters(
|
| @@ -338,6 +340,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
|
| ExecutableElement newElement = node.element;
|
| try {
|
| _assertNotNull(element);
|
| + _assertSameAnnotations(node, element);
|
| _assertEquals(node.isStatic, element.isStatic);
|
| _assertSameType(node.returnType, element.returnType);
|
| _assertCompatibleParameters(node.parameters, element.parameters);
|
| @@ -394,8 +397,8 @@ class DeclarationMatcher extends RecursiveAstVisitor {
|
| }
|
| // verify
|
| PropertyInducingElement newElement = node.name.staticElement;
|
| - _assertNotNull(element);
|
| _processElement(element);
|
| + _assertSameAnnotations(node, element);
|
| _assertEquals(node.isConst, element.isConst);
|
| _assertEquals(node.isFinal, element.isFinal);
|
| if (_enclosingFieldNode != null) {
|
| @@ -511,6 +514,26 @@ class DeclarationMatcher extends RecursiveAstVisitor {
|
| }
|
| }
|
|
|
| + void _assertSameAnnotation(Annotation node, ElementAnnotation annotation) {
|
| + _assertNull(node.arguments);
|
| + Element element = annotation.element;
|
| + _assertTrue(element is PropertyAccessorElement);
|
| + _assertTrue(node.name is SimpleIdentifier);
|
| + String nodeName = node.name.name;
|
| + String elementName = element.displayName;
|
| + _assertEquals(nodeName, elementName);
|
| + }
|
| +
|
| + void _assertSameAnnotations(AnnotatedNode node, Element element) {
|
| + List<Annotation> nodeAnnotaitons = node.metadata;
|
| + List<ElementAnnotation> elementAnnotations = element.metadata;
|
| + int length = nodeAnnotaitons.length;
|
| + _assertEquals(elementAnnotations.length, length);
|
| + for (int i = 0; i < length; i++) {
|
| + _assertSameAnnotation(nodeAnnotaitons[i], elementAnnotations[i]);
|
| + }
|
| + }
|
| +
|
| void _assertSameType(TypeName node, DartType type) {
|
| // no return type == dynamic
|
| if (node == null) {
|
|
|