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

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

Issue 2619243002: Make .enclosingClass always return the declaration (Closed)
Patch Set: Add comment. 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..5d93788d26dbb63da5990219df915aad32a50e59 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -98,7 +98,9 @@ class InitializerResolver {
Element target;
FieldElement field;
if (isFieldInitializer(init)) {
- target = constructor.enclosingClass.lookupLocalMember(name);
+ // Use [enclosingElement] ensure lookup in patch class when necessary.
Siggi Cherem (dart-lang) 2017/01/11 19:24:02 ditto
Johnni Winther 2017/01/12 09:56:56 Done.
+ ClassElement cls = constructor.enclosingElement;
+ target = cls.lookupLocalMember(name);
if (target == null) {
reporter.reportErrorMessage(
selector, MessageKind.CANNOT_RESOLVE, {'name': name});

Powered by Google App Engine
This is Rietveld 408576698