MCPcopy Create free account
hub / github.com/alibaba/GraphScope / IsDerivedFunction

Function IsDerivedFunction

analytical_engine/misc/cpplint.py:5477–5496  ·  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

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