Exemplo n.º 1
0
 /** @return Whether the variable is never assigned a value. */
 boolean isNeverAssigned() {
   int size = references.size();
   for (int i = 0; i < size; i++) {
     Reference ref = references.get(i);
     if (ref.isLvalue() || ref.isInitializingDeclaration()) {
       return false;
     }
   }
   return true;
 }
Exemplo n.º 2
0
 /** @return The one and only assignment. Returns if there are 0 or 2+ assignments. */
 private Reference getOneAndOnlyAssignment() {
   Reference assignment = null;
   int size = references.size();
   for (int i = 0; i < size; i++) {
     Reference ref = references.get(i);
     if (ref.isLvalue() || ref.isInitializingDeclaration()) {
       if (assignment == null) {
         assignment = ref;
       } else {
         return null;
       }
     }
   }
   return assignment;
 }