MCPcopy Create free account
hub / github.com/apache/mesos / IsDerivedFunction

Function IsDerivedFunction

support/cpplint.py:4933–4952  ·  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

4931
4932
4933def IsDerivedFunction(clean_lines, linenum):
4934 """Check if current line contains an inherited function.
4935
4936 Args:
4937 clean_lines: A CleansedLines instance containing the file.
4938 linenum: The number of the line to check.
4939 Returns:
4940 True if current line contains a function with "override"
4941 virt-specifier.
4942 """
4943 # Scan back a few lines for start of current function
4944 for i in xrange(linenum, max(-1, linenum - 10), -1):
4945 match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
4946 if match:
4947 # Look for "override" after the matching closing parenthesis
4948 line, _, closing_paren = CloseExpression(
4949 clean_lines, i, len(match.group(1)))
4950 return (closing_paren >= 0 and
4951 Search(r'\boverride\b', line[closing_paren:]))
4952 return False
4953
4954
4955def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 4

maxFunction · 0.85
MatchFunction · 0.85
CloseExpressionFunction · 0.85
SearchFunction · 0.85

Tested by

no test coverage detected