@@ 5088-5107 (lines=20) @@ | ||
5085 | 'Almost always, snprintf is better than %s' % match.group(1)) |
|
5086 | ||
5087 | ||
5088 | def IsDerivedFunction(clean_lines, linenum): |
|
5089 | """Check if current line contains an inherited function. |
|
5090 | ||
5091 | Args: |
|
5092 | clean_lines: A CleansedLines instance containing the file. |
|
5093 | linenum: The number of the line to check. |
|
5094 | Returns: |
|
5095 | True if current line contains a function with "override" |
|
5096 | virt-specifier. |
|
5097 | """ |
|
5098 | # Scan back a few lines for start of current function |
|
5099 | for i in xrange(linenum, max(-1, linenum - 10), -1): |
|
5100 | match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i]) |
|
5101 | if match: |
|
5102 | # Look for "override" after the matching closing parenthesis |
|
5103 | line, _, closing_paren = CloseExpression( |
|
5104 | clean_lines, i, len(match.group(1))) |
|
5105 | return (closing_paren >= 0 and |
|
5106 | Search(r'\boverride\b', line[closing_paren:])) |
|
5107 | return False |
|
5108 | ||
5109 | ||
5110 | def IsOutOfLineMethodDefinition(clean_lines, linenum): |
@@ 5088-5107 (lines=20) @@ | ||
5085 | 'Almost always, snprintf is better than %s' % match.group(1)) |
|
5086 | ||
5087 | ||
5088 | def IsDerivedFunction(clean_lines, linenum): |
|
5089 | """Check if current line contains an inherited function. |
|
5090 | ||
5091 | Args: |
|
5092 | clean_lines: A CleansedLines instance containing the file. |
|
5093 | linenum: The number of the line to check. |
|
5094 | Returns: |
|
5095 | True if current line contains a function with "override" |
|
5096 | virt-specifier. |
|
5097 | """ |
|
5098 | # Scan back a few lines for start of current function |
|
5099 | for i in xrange(linenum, max(-1, linenum - 10), -1): |
|
5100 | match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i]) |
|
5101 | if match: |
|
5102 | # Look for "override" after the matching closing parenthesis |
|
5103 | line, _, closing_paren = CloseExpression( |
|
5104 | clean_lines, i, len(match.group(1))) |
|
5105 | return (closing_paren >= 0 and |
|
5106 | Search(r'\boverride\b', line[closing_paren:])) |
|
5107 | return False |
|
5108 | ||
5109 | ||
5110 | def IsOutOfLineMethodDefinition(clean_lines, linenum): |