anchor.diff:        _bestSplits = splits;
         _lowestCost = cost;
       }
  +  }
  +
  +  /// Makes the empty split set a valid solution.
  +  void allowEmpty() {
  +    _bestSplits = new SplitSet();
  +    _lowestCost = 0;
     }
   }
   
  
positive.code:     return nestingLevels.length;
    }
  
    /// Finds the best set of splits to apply to the remainder of the line
    /// following [prefix].
    SplitSet _findBestSplits(LinePrefix prefix) {
      // Use the memoized result if we have it.
      if (_bestSplits.containsKey(prefix)) return _bestSplits[prefix];
  
      // We never need to split at the end of the last chunk.
      if (prefix.length == _chunks.length - 1) {
        return _bestSplits[prefix] = new SplitSet();
      }
  
      var chunk = _chunks[prefix.length];
      var bestSplits = new BestSplits();
  
      // See if this chunk's rule already has a value.
      var value = prefix.ruleValues[chunk.rule];
      if (value == null) {
        // No, so try every value for the rule.
        for (var value = 0; value < chunk.rule.numValues; value++) {
          _findBestSplitsForValue(prefix, bestSplits, value);
        }
      } else {
        // It does, so stick with it.
        _findBestSplitsForValue(prefix, bestSplits, value);
      }
  
      return _bestSplits[prefix] = bestSplits.splits;
    }
  
    /// Looks for sets of splits to apply to the suffix after [prefix], using
    /// [value] for the rule of the chunk just after the prefix.
    ///
    /// Updates [bestSplits] with candidate solutions that it finds.
    void _findBestSplitsForValue(
        LinePrefix prefix, BestSplits bestSplits, int value) {
      var chunk = _chunks[prefix.length];
  
      var isSplit = chunk.rule.isSplit(value, chunk);
  
      // If we're in a block that decided not to split, we can't allow any other
      // splits.
      if (isSplit && prefix.isInUnsplitBlock) return;
  
      // Create new prefixes including this chunk.
      if (!isSplit) {
        _tryLongerPrefix(prefix, bestSplits,
            prefix.advanceUnsplit(_chunks, value), isSplit);
      } else {
        // There can be multiple since there are different ways to handle a
        // jump in nesting depth.
        for (var longerPrefix in prefix.advanceSplit(_chunks, value)) {
          _tryLongerPrefix(prefix, bestSplits, longerPrefix, isSplit);
        }
      }
    }
  
    // TODO(bob): Doc.
    void _tryLongerPrefix(LinePrefix prefix, BestSplits bestSplits,
        LinePrefix longerPrefix, bool isSplit) {
      var remaining = _findBestSplits(longerPrefix);
  
      // If it wasn't possible to split the suffix given this nesting stack,
      // skip it.
      if (remaining == null) return;
  
      var splits = remaining;
      if (isSplit) {
        splits = remaining.add(prefix.length, longerPrefix.nestingIndent);
      }
  
      var indent = prefix.getNextLineIndent(_chunks, _indent);
      var cost = _evaluateCost(prefix, indent, splits);
      bestSplits.update(splits, cost);
    }
  
    /// Evaluates the cost (i.e. the relative "badness") of splitting the line
  
negative.code:   }
  }
  
  /// Keeps track of the best set of splits found so far for a suffix of some
  /// prefix.
  class Solution {
    /// The prefix whose suffix we are finding a solution for.
    final LinePrefix prefix;
  
    /// The indentation at the beginning of the suffix.
    final int _indent;
  
    SplitSet _bestSplits;
    int _lowestCost;
  
    /// The best set of splits currently found.
    SplitSet get splits => _bestSplits;
  
    Solution(this.prefix, this._indent);
  
    /// Compares [splits] to the best solution found so far and keeps it if it's
    /// better.
    void update(LineSplitter splitter, SplitSet splits) {
      var cost = splitter._evaluateCost(prefix, _indent, splits);
  
      // TODO(bob): Is weight still needed?
      if (_lowestCost == null ||
          cost < _lowestCost/* ||
  