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

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

Issue 2798663003: Fix generic function types in variable declarations (issue 29237) (Closed)
Patch Set: Created 3 years, 8 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/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index ea9a4281206ee0afeb8b179dd1bd997a4385cb59..57c8d14c73e748b8e4db5e39c3c79988ff08caa3 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -3147,7 +3147,8 @@ abstract class ElementImpl implements Element {
*/
DartType _checkElementOfType(DartType type) {
Element element = type?.element;
- if (element is GenericFunctionTypeElementImpl) {
+ if (element is GenericFunctionTypeElementImpl &&
+ element.enclosingElement == null) {
element.enclosingElement = this;
}
return type;
@@ -7192,8 +7193,9 @@ abstract class NonParameterVariableElementImpl extends VariableElementImpl {
if (_unlinkedVariable != null && _initializer == null) {
UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer;
if (unlinkedInitializer != null) {
- _initializer = new FunctionElementImpl.forSerialized(
- unlinkedInitializer, this)..isSynthetic = true;
+ _initializer =
+ new FunctionElementImpl.forSerialized(unlinkedInitializer, this)
+ ..isSynthetic = true;
} else {
return null;
}
@@ -7484,8 +7486,9 @@ class ParameterElementImpl extends VariableElementImpl
if (_unlinkedParam != null && _initializer == null) {
UnlinkedExecutable unlinkedInitializer = _unlinkedParam.initializer;
if (unlinkedInitializer != null) {
- _initializer = new FunctionElementImpl.forSerialized(
- unlinkedInitializer, this)..isSynthetic = true;
+ _initializer =
+ new FunctionElementImpl.forSerialized(unlinkedInitializer, this)
+ ..isSynthetic = true;
} else {
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | pkg/analyzer/lib/src/generated/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698