MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / IsDerivedFunction

Function IsDerivedFunction

src/tests/coding/cpplint.py:5474–5493  ·  view source on GitHub ↗

Check if current line contains an inherited function. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if current line contains a function with "override" virt-specifier.

(clean_lines, linenum)

Source from the content-addressed store, hash-verified

5472
5473
5474def IsDerivedFunction(clean_lines, linenum):
5475 """Check if current line contains an inherited function.
5476
5477 Args:
5478 clean_lines: A CleansedLines instance containing the file.
5479 linenum: The number of the line to check.
5480 Returns:
5481 True if current line contains a function with "override"
5482 virt-specifier.
5483 """
5484 # Scan back a few lines for start of current function
5485 for i in xrange(linenum, max(-1, linenum - 10), -1):
5486 match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
5487 if match:
5488 # Look for "override" after the matching closing parenthesis
5489 line, _, closing_paren = CloseExpression(
5490 clean_lines, i, len(match.group(1)))
5491 return (closing_paren >= 0 and
5492 Search(r'\boverride\b', line[closing_paren:]))
5493 return False
5494
5495
5496def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 4

CloseExpressionFunction · 0.85
SearchFunction · 0.85
MatchFunction · 0.70
groupMethod · 0.45

Tested by

no test coverage detected