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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 11280065: Issue 6779. Report error for missing getter/setter in unqualified field access (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index 0c6eee03bcc4e83562dc1c11406be99d862f97ca..c3fd4d8e3549192495551baa81dcecc0389e561d 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -1262,6 +1262,20 @@ public class Resolver {
}
}
+ if (ElementKind.of(element) == ElementKind.FIELD) {
+ FieldElement fieldElement = (FieldElement) element;
+ if (fieldElement.getModifiers().isAbstractField()) {
+ if (fieldElement.getGetter() == null && ASTNodes.inGetterContext(x)) {
+ topLevelContext.onError(x, ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_GETTER);
+ x.markResolutionAlreadyReportedThatTheMethodCouldNotBeFound();
+ }
+ if (fieldElement.getSetter() == null && ASTNodes.inSetterContext(x)) {
+ topLevelContext.onError(x, ResolverErrorCode.FIELD_DOES_NOT_HAVE_A_SETTER);
+ x.markResolutionAlreadyReportedThatTheMethodCouldNotBeFound();
+ }
+ }
+ }
+
// May be local variable declared in lexical scope, but its declaration is not visited yet.
if (getContext().getScope().isDeclaredButNotReachedVariable(name)) {
onError(x, ResolverErrorCode.USING_LOCAL_VARIABLE_BEFORE_DECLARATION, x);
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698