anchor.diff:      }
       newDefinition.firstRef = firstRef;
       firstRef = null;
  +  }
  +}
  +
  +/// Operands to invocations and primitives are always variables.  They point to
  +/// their definition and are doubly-linked into a list of occurrences.
  +class Reference<T extends Definition<T>> {
  +  T definition;
  +  Reference<T> previous;
  +  Reference<T> next;
  +
  +  /// A pointer to the parent node. Is null until set by optimization passes.
  +  Node parent;
  +
  +  Reference(this.definition) {
  +    next = definition.firstRef;
  +    if (next != null) next.previous = this;
  +    definition.firstRef = this;
  +  }
  +
  +  /// Unlinks this reference from the list of occurrences.
  +  void unlink() {
  +    if (previous == null) {
  +      assert(definition.firstRef == this);
  +      definition.firstRef = next;
  +    } else {
  +      previous.next = next;
  +    }
  +    if (next != null) next.previous = previous;
  +  }
  +
  +  /// Changes the definition referenced by this object and updates
  +  /// the reference chains accordingly.
  +  void changeTo(Definition<T> newDefinition) {
  +    unlink();
  +    previous = null;
  +    definition = newDefinition;
  +    next = definition.firstRef;
  +    if (next != null) next.previous = this;
  +    definition.firstRef = this;
     }
   }
   
  
positive.code:   }
  
    Expression traverseLetMutable(LetMutable node) {
      plug(new LetMutable(_definitions.copy(node.variable),
          _definitions.getCopy(node.valueRef)));
      return node.body;
    }
  
    // Tail expressions do not have references, so we do not need to map them
    // to their copies.
    visitInvokeContinuation(InvokeContinuation node) {
      plug(new InvokeContinuation(_copies[node.continuation],
          _definitions.getList(node.argumentRefs),
          isRecursive: node.isRecursive,
          isEscapingTry: node.isEscapingTry,
          sourceInformation: node.sourceInformation));
  
negative.code:   }
  
    Definition visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
      return new ApplyBuiltinOperator(
          node.operator, getList(node.argumentRefs), node.sourceInformation);
    }
  
    Definition visitApplyBuiltinMethod(ApplyBuiltinMethod node) {
      return new ApplyBuiltinMethod(node.method, getCopy(node.receiverRef),
          getList(node.argumentRefs), node.sourceInformation);
    }
  
    Definition visitGetLength(GetLength node) {
  