Push a new item in this union. The ending position of this union's span is updated to the ending position of the span of the item given. If the union is empty, then the starting position of this union is set to the starting position of this item. In other words, if you only use this method to add items to a union and you set the spans on each item correctly, then you should never need to adjust
(&mut self, item: ClassSetItem)
| 1044 | /// and you set the spans on each item correctly, then you should never |
| 1045 | /// need to adjust the span of the union directly. |
| 1046 | pub fn push(&mut self, item: ClassSetItem) { |
| 1047 | if self.items.is_empty() { |
| 1048 | self.span.start = item.span().start; |
| 1049 | } |
| 1050 | self.span.end = item.span().end; |
| 1051 | self.items.push(item); |
| 1052 | } |
| 1053 | |
| 1054 | /// Return this union as a character class set item. |
| 1055 | /// |