Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index b80ed5a2deaca94429c70bb7a6759ea33bb33889..c126b44a31e72e35f94d5878ff1112297d27e232 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -2154,13 +2154,18 @@ class DeclarationResolver extends RecursiveAstVisitor<Object> { |
_findIdentifier(_enclosingUnit.functions, functionName); |
} |
} else { |
- PropertyAccessorElement accessor = |
- _findIdentifier(_enclosingUnit.accessors, functionName); |
- if ((property as sc.KeywordToken).keyword == sc.Keyword.SET) { |
- accessor = accessor.variable.setter; |
- functionName.staticElement = accessor; |
+ if (_enclosingExecutable != null) { |
+ _enclosingExecutable = |
+ _findIdentifier(_enclosingExecutable.functions, functionName); |
+ } else { |
+ PropertyAccessorElement accessor = |
+ _findIdentifier(_enclosingUnit.accessors, functionName); |
+ if ((property as sc.KeywordToken).keyword == sc.Keyword.SET) { |
+ accessor = accessor.variable.setter; |
+ functionName.staticElement = accessor; |
+ } |
+ _enclosingExecutable = accessor; |
} |
- _enclosingExecutable = accessor; |
} |
node.functionExpression.element = _enclosingExecutable; |
return super.visitFunctionDeclaration(node); |