MCPcopy Index your code
hub / github.com/nodejs/node / IsDerivedFunction

Function IsDerivedFunction

tools/cpplint.py:6378–6395  ·  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

6376
6377
6378def IsDerivedFunction(clean_lines, linenum):
6379 """Check if current line contains an inherited function.
6380
6381 Args:
6382 clean_lines: A CleansedLines instance containing the file.
6383 linenum: The number of the line to check.
6384 Returns:
6385 True if current line contains a function with "override"
6386 virt-specifier.
6387 """
6388 # Scan back a few lines for start of current function
6389 for i in range(linenum, max(-1, linenum - 10), -1):
6390 match = re.match(r"^([^()]*\w+)\(", clean_lines.elided[i])
6391 if match:
6392 # Look for "override" after the matching closing parenthesis
6393 line, _, closing_paren = CloseExpression(clean_lines, i, len(match.group(1)))
6394 return closing_paren >= 0 and re.search(r"\boverride\b", line[closing_paren:])
6395 return False
6396
6397
6398def IsOutOfLineMethodDefinition(clean_lines, linenum):

Callers 1

Calls 5

CloseExpressionFunction · 0.85
matchMethod · 0.65
rangeFunction · 0.50
maxFunction · 0.50
searchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…