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

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

Issue 11369050: Issue 6489. Report error when static method attempts to access const instance field. (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
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 fb43f949ee5105e03a8488c9c3164ac1480b66fb..7808c4dd229b778818debf3e4e3f5dd20b34aa27 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -1235,7 +1235,10 @@ public class Resolver {
if (!Elements.isStaticContext(element) && !element.getModifiers().isConstant()) {
if (inInstanceVariableInitializer) {
onError(x, ResolverErrorCode.CANNOT_USE_INSTANCE_FIELD_IN_INSTANCE_FIELD_INITIALIZER);
- } else if (ASTNodes.isStaticContext(x)) {
+ }
+ }
+ if (ASTNodes.isStaticContext(x) && !Elements.isStaticContext(element)) {
+ if (ASTNodes.isStaticContext(x)) {
Brian Wilkerson 2012/11/02 18:01:23 Why are we testing this again? Don't we already kn
onError(x, ResolverErrorCode.ILLEGAL_FIELD_ACCESS_FROM_STATIC, name);
}
}

Powered by Google App Engine
This is Rietveld 408576698