MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / IsDerivedFunction

Function IsDerivedFunction

steps/cpplint.py:5487–5506  ·  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

5485
5486
5487def IsDerivedFunction(clean_lines, linenum):
5488 """Check if current line contains an inherited function.
5489
5490 Args:
5491 clean_lines: A CleansedLines instance containing the file.
5492 linenum: The number of the line to check.
5493 Returns:
5494 True if current line contains a function with "override"
5495 virt-specifier.
5496 """
5497 # Scan back a few lines for start of current function
5498 for i in xrange(linenum, max(-1, linenum - 10), -1):
5499 match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
5500 if match:
5501 # Look for "override" after the matching closing parenthesis
5502 line, _, closing_paren = CloseExpression(
5503 clean_lines, i, len(match.group(1)))
5504 return (closing_paren >= 0 and
5505 Search(r'\boverride\b', line[closing_paren:]))
5506 return False
5507
5508
5509def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 3

MatchFunction · 0.85
CloseExpressionFunction · 0.85
SearchFunction · 0.85

Tested by

no test coverage detected