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

Method _UpdateNamesapce

tools/cpplint.py:3497–3522  ·  view source on GitHub ↗

Match start of namespace, append to stack, and consume line Args: line: Line to check and consume linenum: Line number of the line to check Returns: The consumed line if namespace matched; None otherwise

(self, line: str, linenum: int)

Source from the content-addressed store, hash-verified

3495 inner_block.inline_asm = _END_ASM
3496
3497 def _UpdateNamesapce(self, line: str, linenum: int) -> str | None:
3498 """
3499 Match start of namespace, append to stack, and consume line
3500 Args:
3501 line: Line to check and consume
3502 linenum: Line number of the line to check
3503
3504 Returns:
3505 The consumed line if namespace matched; None otherwise
3506 """
3507 # Match start of namespace. The "\b\s*" below catches namespace
3508 # declarations even if it weren't followed by a whitespace, this
3509 # is so that we don't confuse our namespace checker. The
3510 # missing spaces will be flagged by CheckSpacing.
3511 namespace_decl_match = re.match(r"^\s*namespace\b\s*([:\w]+)?(.*)$", line)
3512 if not namespace_decl_match:
3513 return None
3514
3515 new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
3516 self.stack.append(new_namespace)
3517
3518 line = namespace_decl_match.group(2)
3519 if line.find("{") != -1:
3520 new_namespace.seen_open_brace = True
3521 line = line[line.find("{") + 1 :]
3522 return line
3523
3524 def _UpdateConstructor(self, line: str, linenum: int, class_name: str | None = None):
3525 """

Callers 1

UpdateMethod · 0.95

Calls 4

_NamespaceInfoClass · 0.85
matchMethod · 0.65
findMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected