AppendEllipsis appends a new ellipsis node to the list if none already exists at the end. If cs is non-zero it coalesces the statistics with the previous diffStats.
(ds diffStats)
| 151 | // exists at the end. If cs is non-zero it coalesces the statistics with the |
| 152 | // previous diffStats. |
| 153 | func (s *textList) AppendEllipsis(ds diffStats) { |
| 154 | hasStats := !ds.IsZero() |
| 155 | if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) { |
| 156 | if hasStats { |
| 157 | *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true, Comment: ds}) |
| 158 | } else { |
| 159 | *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true}) |
| 160 | } |
| 161 | return |
| 162 | } |
| 163 | if hasStats { |
| 164 | (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func (s textList) Len() (n int) { |
| 169 | for i, r := range s { |
no test coverage detected