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)
| 4207 | |
| 4208 | |
| 4209 | def GetPreviousNonBlankLine(clean_lines, linenum): |
| 4210 | """Return the most recent non-blank line and its line number. |
| 4211 | |
| 4212 | Args: |
| 4213 | clean_lines: A CleansedLines instance containing the file contents. |
| 4214 | linenum: The number of the line to check. |
| 4215 | |
| 4216 | Returns: |
| 4217 | A tuple with two elements. The first element is the contents of the last |
| 4218 | non-blank line before the current line, or the empty string if this is the |
| 4219 | first non-blank line. The second is the line number of that line, or -1 |
| 4220 | if this is the first non-blank line. |
| 4221 | """ |
| 4222 | |
| 4223 | prevlinenum = linenum - 1 |
| 4224 | while prevlinenum >= 0: |
| 4225 | prevline = clean_lines.elided[prevlinenum] |
| 4226 | if not IsBlankLine(prevline): # if not a blank line... |
| 4227 | return (prevline, prevlinenum) |
| 4228 | prevlinenum -= 1 |
| 4229 | return ('', -1) |
| 4230 | |
| 4231 | |
| 4232 | def CheckBraces(filename, clean_lines, linenum, error): |
no test coverage detected