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

Function IsBlockInNameSpace

tools/cpplint.py:7318–7347  ·  view source on GitHub ↗

Checks that the new block is directly in a namespace. Args: nesting_state: The NestingState object that contains info about our state. is_forward_declaration: If the class is a forward declared class. Returns: Whether or not the new block is directly in a namespace.

(nesting_state: NestingState, is_forward_declaration: bool)

Source from the content-addressed store, hash-verified

7316# Returns true if we are at a new block, and it is directly
7317# inside of a namespace.
7318def IsBlockInNameSpace(nesting_state: NestingState, is_forward_declaration: bool): # noqa: FBT001
7319 """Checks that the new block is directly in a namespace.
7320
7321 Args:
7322 nesting_state: The NestingState object that contains info about our state.
7323 is_forward_declaration: If the class is a forward declared class.
7324 Returns:
7325 Whether or not the new block is directly in a namespace.
7326 """
7327 if is_forward_declaration:
7328 return len(nesting_state.stack) >= 1 and (
7329 isinstance(nesting_state.stack[-1], _NamespaceInfo)
7330 )
7331
7332 if len(nesting_state.stack) >= 1:
7333 if isinstance(nesting_state.stack[-1], _NamespaceInfo):
7334 return True
7335 if (
7336 len(nesting_state.stack) > 1
7337 and isinstance(nesting_state.previous_stack_top, _NamespaceInfo)
7338 and (
7339 isinstance(nesting_state.stack[-2], _NamespaceInfo)
7340 or len(nesting_state.stack) > 2 # Accommodate for WrappedInfo
7341 and issubclass(type(nesting_state.stack[-1]), _WrappedInfo)
7342 and not nesting_state.stack[-2].seen_open_brace
7343 and isinstance(nesting_state.stack[-3], _NamespaceInfo)
7344 )
7345 ):
7346 return True
7347 return False
7348
7349
7350def ShouldCheckNamespaceIndentation(

Callers 1

Calls 1

typeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…