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)
| 3711 | |
| 3712 | |
| 3713 | def GetPreviousNonBlankLine(clean_lines, linenum): |
| 3714 | """Return the most recent non-blank line and its line number. |
| 3715 | |
| 3716 | Args: |
| 3717 | clean_lines: A CleansedLines instance containing the file contents. |
| 3718 | linenum: The number of the line to check. |
| 3719 | |
| 3720 | Returns: |
| 3721 | A tuple with two elements. The first element is the contents of the last |
| 3722 | non-blank line before the current line, or the empty string if this is the |
| 3723 | first non-blank line. The second is the line number of that line, or -1 |
| 3724 | if this is the first non-blank line. |
| 3725 | """ |
| 3726 | |
| 3727 | prevlinenum = linenum - 1 |
| 3728 | while prevlinenum >= 0: |
| 3729 | prevline = clean_lines.elided[prevlinenum] |
| 3730 | if not IsBlankLine(prevline): # if not a blank line... |
| 3731 | return (prevline, prevlinenum) |
| 3732 | prevlinenum -= 1 |
| 3733 | return ('', -1) |
| 3734 | |
| 3735 | |
| 3736 | def CheckBraces(filename, clean_lines, linenum, error): |
no test coverage detected