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

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

Issue 2651683004: Fix resynthesizing field of FieldFormalParameterElement. (Closed)
Patch Set: Created 3 years, 11 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/compile_time_error_code_driver_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/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index c01d7d8a0ce6b91403548743ce22486b73e9dd1d..9892b1870cdf8f0539d655746327278b19b28370 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -4317,9 +4317,14 @@ class FieldFormalParameterElementImpl extends ParameterElementImpl
@override
FieldElement get field {
if (_unlinkedParam != null && _field == null) {
- Element enclosingClass = enclosingElement?.enclosingElement;
- if (enclosingClass is ClassElement) {
- _field = enclosingClass.getField(_unlinkedParam.name);
+ Element enclosing = enclosingElement?.enclosingElement;
+ while (enclosing != null) {
+ if (enclosing is ClassElement) {
+ _field = enclosing.getField(_unlinkedParam.name);
+ break;
+ } else {
+ enclosing = enclosing.enclosingElement;
+ }
}
}
return _field;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698