Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. linenum: The number of the line to check. Returns: A tuple with two elements. The first element is the contents of the last non-blank line befor
(clean_lines, linenum)
| 4220 | |
| 4221 | |
| 4222 | def GetPreviousNonBlankLine(clean_lines, linenum): |
| 4223 | """Return the most recent non-blank line and its line number. |
| 4224 | |
| 4225 | Args: |
| 4226 | clean_lines: A CleansedLines instance containing the file contents. |
| 4227 | linenum: The number of the line to check. |
| 4228 | |
| 4229 | Returns: |
| 4230 | A tuple with two elements. The first element is the contents of the last |
| 4231 | non-blank line before the current line, or the empty string if this is the |
| 4232 | first non-blank line. The second is the line number of that line, or -1 |
| 4233 | if this is the first non-blank line. |
| 4234 | """ |
| 4235 | |
| 4236 | prevlinenum = linenum - 1 |
| 4237 | while prevlinenum >= 0: |
| 4238 | prevline = clean_lines.elided[prevlinenum] |
| 4239 | if not IsBlankLine(prevline): # if not a blank line... |
| 4240 | return (prevline, prevlinenum) |
| 4241 | prevlinenum -= 1 |
| 4242 | return ('', -1) |
| 4243 | |
| 4244 | |
| 4245 | def CheckBraces(filename, clean_lines, linenum, error): |
no test coverage detected