Add an indented lin with a given a `location` appended as a comment to the line (this is useful for identifying where a line was generated).
(&mut self, contents: impl AsRef<str>, location: FileLocation)
| 139 | /// Add an indented lin with a given a `location` appended as a comment to |
| 140 | /// the line (this is useful for identifying where a line was generated). |
| 141 | pub fn line_with_location(&mut self, contents: impl AsRef<str>, location: FileLocation) { |
| 142 | let indent = self.get_indent(); |
| 143 | let contents = contents.as_ref(); |
| 144 | let indented_line = if self.lang.should_append_location(contents) { |
| 145 | let comment_token = self.lang.comment_token(); |
| 146 | format!("{indent}{contents} {comment_token} {location}\n") |
| 147 | } else { |
| 148 | format!("{indent}{contents}\n") |
| 149 | }; |
| 150 | self.lines.push(indented_line); |
| 151 | } |
| 152 | |
| 153 | /// Pushes an empty line. |
| 154 | pub fn empty_line(&mut self) { |
nothing calls this directly
no test coverage detected