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

Unified Diff: pkg/analyzer/lib/src/generated/incremental_resolver.dart

Issue 832143007: Issue 22044. A changes in annotations should be considered as a mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Positive tests. Created 5 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698