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

Unified Diff: pkg/analyzer/lib/src/dart/constant/utilities.dart

Issue 1958433002: Do not fail when an enum constant is annotated (issue 26413) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/src/dart/constant/utilities_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/constant/utilities.dart
diff --git a/pkg/analyzer/lib/src/dart/constant/utilities.dart b/pkg/analyzer/lib/src/dart/constant/utilities.dart
index 80e736bbb358cc939ba17b3dc3d57a8fbebb83c7..7815baca8d1c16a115b0b6ac729357c71bd2661f 100644
--- a/pkg/analyzer/lib/src/dart/constant/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/constant/utilities.dart
@@ -172,8 +172,10 @@ class ConstantFinder extends RecursiveAstVisitor<Object> {
super.visitAnnotation(node);
ElementAnnotation elementAnnotation = node.elementAnnotation;
if (elementAnnotation == null) {
- // Analyzer ignores annotations on "part of" directives.
- assert(node.parent is PartOfDirective);
+ // Analyzer ignores annotations on "part of" directives and on enum
+ // constant declarations.
+ assert(node.parent is PartOfDirective ||
+ node.parent is EnumConstantDeclaration);
} else {
constantsToCompute.add(elementAnnotation);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/constant/utilities_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698