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-blan
(clean_lines, linenum)
| 4795 | |
| 4796 | |
| 4797 | def GetPreviousNonBlankLine(clean_lines, linenum): |
| 4798 | """Return the most recent non-blank line and its line number. |
| 4799 | |
| 4800 | Args: |
| 4801 | clean_lines: A CleansedLines instance containing the file contents. |
| 4802 | linenum: The number of the line to check. |
| 4803 | |
| 4804 | Returns: |
| 4805 | A tuple with two elements. The first element is the contents of the last |
| 4806 | non-blank line before the current line, or the empty string if this is the |
| 4807 | first non-blank line. The second is the line number of that line, or -1 |
| 4808 | if this is the first non-blank line. |
| 4809 | """ |
| 4810 | |
| 4811 | prevlinenum = linenum - 1 |
| 4812 | while prevlinenum >= 0: |
| 4813 | prevline = clean_lines.elided[prevlinenum] |
| 4814 | if not IsBlankLine(prevline): # if not a blank line... |
| 4815 | return (prevline, prevlinenum) |
| 4816 | prevlinenum -= 1 |
| 4817 | return ("", -1) |
| 4818 | |
| 4819 | |
| 4820 | def CheckBraces(filename, clean_lines, linenum, error): |
no test coverage detected
searching dependent graphs…