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

Unified Diff: compiler/java/com/google/dart/compiler/ast/ASTNodes.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/ast/ASTNodes.java
diff --git a/compiler/java/com/google/dart/compiler/ast/ASTNodes.java b/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
index 104b56c8a9044ddcada92de9bfd5760df5c8837e..82bc8559b9fcfde6da0cc261ab0b89b8af532c03 100644
--- a/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
+++ b/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
@@ -37,10 +37,10 @@ import java.util.List;
public class ASTNodes {
/**
- * @return <code>true</code> if given {@link DartNode} is part of static method or top-level
- * function.
+ * @return <code>true</code> if given {@link DartNode} is part of static method, static field or
+ * top-level function.
*/
- public static boolean isStaticContext(DartNode node ) {
+ public static boolean isStaticContext(DartNode node) {
while (node != null) {
DartNode parent = node.getParent();
if (node instanceof DartMethodDefinition) {
@@ -52,7 +52,7 @@ public class ASTNodes {
}
if (node instanceof DartField) {
DartField field = (DartField) node;
- if (field.getModifiers().isStatic() || field.getModifiers().isConstant()) {
+ if (field.getModifiers().isStatic()) {
return true;
}
return parent != null && parent.getParent() instanceof DartUnit;

Powered by Google App Engine
This is Rietveld 408576698