function getNewScope(swcPath, currentScope, traversalContext) {
  const { node, parent } = swcPath;
  // const hasNonBlockParent = (/** @type {SwcNode} */ nd) => nonBlockParentTypes.includes(nd.type);
  const isFn = (/** @type {SwcNode} */ nd) => nd && fnTypes.includes(nd.type);

  const isIsolatedBlockStatement = !isFn(parent) && node.type === 'BlockStatement';

  // Create new scope...
  if (nonBlockParentTypes.includes(node.type) || isIsolatedBlockStatement) {
    // eslint-disable-next-line no-param-reassign
    traversalContext.scopeId += 1;
    return {
      id: traversalContext.scopeId,
      parentScope: currentScope,
      path: swcPath,
      bindings: {},
      getBinding(identifierName) {
        let parentScope = currentScope;
        let foundBinding;
        while (!foundBinding && parentScope) {
          foundBinding = parentScope.bindings[identifierName];
          parentScope = parentScope.parentScope;
        }
        return foundBinding;
      },
      _pendingRefsWithoutBinding: [],
      _isIsolatedBlockStatement: isIsolatedBlockStatement,
    };
  }

  return null;
}
@param {SwcPath} swcPath
@param {SwcScope} currentScope
@param {SwcTraversalContext} traversalContext
@returns {SwcScope|null}