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

Unified Diff: pkg/analyzer/lib/src/dart/element/builder.dart

Issue 1705773002: Discard function elements created while building elements in annotations (issue 25696) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/all_the_rest_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/element/builder.dart
diff --git a/pkg/analyzer/lib/src/dart/element/builder.dart b/pkg/analyzer/lib/src/dart/element/builder.dart
index ef51b61588dfabe192afde17113f7605b5bdb082..594fdf18cf0640bef2e3c2b776fef54878bd1704 100644
--- a/pkg/analyzer/lib/src/dart/element/builder.dart
+++ b/pkg/analyzer/lib/src/dart/element/builder.dart
@@ -331,6 +331,24 @@ class ElementBuilder extends RecursiveAstVisitor<Object> {
}
@override
+ Object visitAnnotation(Annotation node) {
+ // Although it isn't valid to do so because closures are not constant
+ // expressions, it's possible for one of the arguments to the constructor to
+ // contain a closure. Wrapping the processing of the annotation this way
+ // prevents these closures from being added to the list of functions in the
+ // annotated declaration.
+ ElementHolder holder = new ElementHolder();
+ ElementHolder previousHolder = _currentHolder;
+ _currentHolder = holder;
+ try {
+ super.visitAnnotation(node);
+ } finally {
+ _currentHolder = previousHolder;
+ }
+ return null;
+ }
+
+ @override
Object visitCatchClause(CatchClause node) {
SimpleIdentifier exceptionParameter = node.exceptionParameter;
if (exceptionParameter != null) {
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698