Added some extra field access info to ExpressionAnalyzer and removed the notion fixed a bug in field ref analysis.

Seen by: knorton


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2253 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
index 8450eb2..d8c9904 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
@@ -42,6 +42,7 @@
  */
 public class ExpressionAnalyzer extends JVisitor {
   private boolean accessesField;
+  private boolean accessesFieldNonFinal;
   private boolean accessesLocal;
   private boolean accessesParameter;
   private boolean assignmentToField;
@@ -60,6 +61,14 @@
   }
 
   /**
+   * Does this expression read or write non-final fields within the scope of the
+   * expression?
+   */
+  public boolean accessesFieldNonFinal() {
+    return accessesFieldNonFinal;
+  }
+
+  /**
    * Does this expression read or write locals within the scope of the
    * expression?
    */
@@ -117,8 +126,14 @@
   @Override
   public void endVisit(JFieldRef x, Context ctx) {
     accessesField = true;
+    if (!x.getTarget().isFinal()) {
+      accessesFieldNonFinal = true;
+    }
 
     JExpression instance = x.getInstance();
+    if (instance == null) {
+      return;
+    }
 
     // Field references using this are always safe
     if (instance instanceof JThisRef) {