MCPcopy Create free account
hub / github.com/alibaba/graph-learn / IsDerivedFunction

Function IsDerivedFunction

dynamic_graph_service/ci/cpplint.py:5183–5202  ·  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

5181
5182
5183def IsDerivedFunction(clean_lines, linenum):
5184 """Check if current line contains an inherited function.
5185
5186 Args:
5187 clean_lines: A CleansedLines instance containing the file.
5188 linenum: The number of the line to check.
5189 Returns:
5190 True if current line contains a function with "override"
5191 virt-specifier.
5192 """
5193 # Scan back a few lines for start of current function
5194 for i in xrange(linenum, max(-1, linenum - 10), -1):
5195 match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
5196 if match:
5197 # Look for "override" after the matching closing parenthesis
5198 line, _, closing_paren = CloseExpression(
5199 clean_lines, i, len(match.group(1)))
5200 return (closing_paren >= 0 and
5201 Search(r'\boverride\b', line[closing_paren:]))
5202 return False
5203
5204
5205def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 3

MatchFunction · 0.85
CloseExpressionFunction · 0.85
SearchFunction · 0.85

Tested by

no test coverage detected