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

Unified Diff: pkg/compiler/lib/src/resolution/constructors.dart

Issue 2619243002: Make .enclosingClass always return the declaration (Closed)
Patch Set: Updated cf. comments 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
Index: pkg/compiler/lib/src/resolution/constructors.dart
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index bd127d0ef3a7abb2a970fd9a4aaa046db7446246..87c8cc72e0253561ea1dc62fdbd1ffab1e64193d 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -98,7 +98,10 @@ class InitializerResolver {
Element target;
FieldElement field;
if (isFieldInitializer(init)) {
- target = constructor.enclosingClass.lookupLocalMember(name);
+ // Use [enclosingElement] instead of [enclosingClass] to ensure lookup in
+ // patch class when necessary.
+ ClassElement cls = constructor.enclosingElement;
+ target = cls.lookupLocalMember(name);
if (target == null) {
reporter.reportErrorMessage(
selector, MessageKind.CANNOT_RESOLVE, {'name': name});
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/serialization/element_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698