(&mut self, c: SourceCursor<'a>)
| 29 | } |
| 30 | |
| 31 | fn write(&mut self, c: SourceCursor<'a>) { |
| 32 | if let Some(last) = self.last_token |
| 33 | && last.needs_separator_for(c.token()) |
| 34 | { |
| 35 | self.sink.append(SourceCursor::SPACE); |
| 36 | } |
| 37 | self.last_token = Some(c.token()); |
| 38 | let is_ident_like = |
| 39 | matches!(c.token().kind(), Kind::Ident | Kind::Function | Kind::AtKeyword | Kind::Hash | Kind::String); |
| 40 | let should_expand = matches!(c.token().kind(), Kind::Whitespace | Kind::Number | Kind::Dimension | Kind::Url) |
| 41 | || (is_ident_like && self.escape_idents); |
| 42 | if should_expand { |
| 43 | self.sink.append(c.expand()); |
| 44 | } else { |
| 45 | self.sink.append(c); |
| 46 | } |
| 47 | // Add extra semicolons after each semicolon |
| 48 | if c == Kind::Semicolon { |
| 49 | for _ in 0..self.extra_semicolons { |
| 50 | self.sink.append(SourceCursor::SEMICOLON); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | impl<'a, T: SourceCursorSink<'a>> CursorSink for CursorExpandedWriteSink<'a, T> { |
no test coverage detected