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)
| 4727 | |
| 4728 | |
| 4729 | def GetPreviousNonBlankLine(clean_lines, linenum): |
| 4730 | """Return the most recent non-blank line and its line number. |
| 4731 | |
| 4732 | Args: |
| 4733 | clean_lines: A CleansedLines instance containing the file contents. |
| 4734 | linenum: The number of the line to check. |
| 4735 | |
| 4736 | Returns: |
| 4737 | A tuple with two elements. The first element is the contents of the last |
| 4738 | non-blank line before the current line, or the empty string if this is the |
| 4739 | first non-blank line. The second is the line number of that line, or -1 |
| 4740 | if this is the first non-blank line. |
| 4741 | """ |
| 4742 | |
| 4743 | prevlinenum = linenum - 1 |
| 4744 | while prevlinenum >= 0: |
| 4745 | prevline = clean_lines.elided[prevlinenum] |
| 4746 | if not IsBlankLine(prevline): # if not a blank line... |
| 4747 | return (prevline, prevlinenum) |
| 4748 | prevlinenum -= 1 |
| 4749 | return ("", -1) |
| 4750 | |
| 4751 | |
| 4752 | def CheckBraces(filename, clean_lines, linenum, error): |
no test coverage detected