Simplify ConvertToTagTrees and remove incorrect edge case handling
* `buffers` is an unnecessary intermediate variable. Any text buffer present in `buffersToTag` but not also present in `buffers` will end up ignored by `ComputeNewTagTree`, and thus not influence the result of `ConvertToTagTrees`. Based on this, `buffers` was eliminated to simplify the implementation. * When `spansTagged` has only a single span, it's possible that other tag trees in `oldTagTrees` need to propagate forward. The early return failed to account for this, and if hit would drop `oldTagTrees` tags for buffers not equal to the buffer from `spansTagged`. In addition, the early return failed to account for the case where `spansTagged` only contained a single span from a buffer not requested per `buffersToTag`. Following the elimination of `buffers`, the value of a special case handling here was notably reduced and the edge case was simply eliminated in favor of the remaining code in the method. * The patter of Select followed by ToLookup was replaced by a single call to ToLookup specifying both the keys and the values of the resulting lookup.
Showing
想要评论请 注册 或 登录