anchor.diff:        node.elseExpression = tmp;
       }
   
  +    // x ? y : x ==> x && y
  +    if (isSameVariable(node.condition, node.elseExpression)) {
  +      destroyVariableUse(node.elseExpression);
  +      return new LogicalOperator.and(node.condition, node.thenExpression);
  +    }
  +    // x ? x : y ==> x || y
  +    if (isSameVariable(node.condition, node.thenExpression)) {
  +      destroyVariableUse(node.thenExpression);
  +      return new LogicalOperator.or(node.condition, node.elseExpression);
  +    }
  +
       return node;
     }
   
  
positive.code:         e.elseExpression = (e.elseExpression as Not).operand;
          return new Not(e);
        }
        return e;
      }
      if (e is Constant && e.value.isBool) {
  
negative.code:       return new LogicalOperator.or(e1, e2);
      }
    }
  
    /// True if [e2] is known to return the same value as [e1] 
    /// (with no additional side effects) if evaluated immediately after [e1].
    /// 
    /// Concretely, this is true if [e1] and [e2] are uses of the same variable,
    /// or if [e2] is a use of a variable assigned by [e1].
    bool isSameVariable(Expression e1, Expression e2) {
      if (e1 is VariableUse) {
        return e2 is VariableUse && e1.variable == e2.variable;
      } else if (e1 is Assign) {
        return e2 is VariableUse && e1.variable == e2.variable;
      }
      return false;
    }
  
    void destroyVariableUse(VariableUse node) {
      --node.variable.readCount;
    }
  }
  
  