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

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

Issue 1024553006: Issue 22962. Adding/removing method/accessor body is a declartion mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/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 b7a1ffe11e174e678205f355f0a8e4c7f5d05588..ea6aac756d505d21ec7899938dbe1227ef36478a 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -268,7 +268,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
_assertSameType(node.returnType, element.returnType);
_assertCompatibleParameters(
node.functionExpression.parameters, element.parameters);
- _assertBodyModifiers(node.functionExpression.body, element);
+ _assertBody(node.functionExpression.body, element);
// matches, update the existing element
ExecutableElement newElement = node.element;
node.name.staticElement = element;
@@ -342,7 +342,7 @@ class DeclarationMatcher extends RecursiveAstVisitor {
_assertEquals(node.isStatic, element.isStatic);
_assertSameType(node.returnType, element.returnType);
_assertCompatibleParameters(node.parameters, element.parameters);
- _assertBodyModifiers(node.body, element);
+ _assertBody(node.body, element);
_removedElements.remove(element);
// matches, update the existing element
node.name.staticElement = element;
@@ -420,12 +420,18 @@ class DeclarationMatcher extends RecursiveAstVisitor {
}
/**
- * Asserts that [body] has async / generator modifiers compatible with the
- * given [element].
+ * Assert that the given [body] is compatible with the given [element].
+ * It should not be empty if the [element] is not an abstract class member.
+ * If it is present, it should have the same async / generator modifiers.
*/
- void _assertBodyModifiers(FunctionBody body, ExecutableElementImpl element) {
- _assertEquals(body.isSynchronous, element.isSynchronous);
- _assertEquals(body.isGenerator, element.isGenerator);
+ void _assertBody(FunctionBody body, ExecutableElementImpl element) {
+ if (body is EmptyFunctionBody) {
+ _assertTrue(element.isAbstract);
+ } else {
+ _assertFalse(element.isAbstract);
+ _assertEquals(body.isSynchronous, element.isSynchronous);
+ _assertEquals(body.isGenerator, element.isGenerator);
+ }
}
void _assertCombinators(List<Combinator> nodeCombinators,
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_handle.dart ('k') | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698