function isIdentifierReference(node) {
  const parent = node.parent;

  switch (parent.type) {
    case 'LabeledStatement':
    case 'BreakStatement':
    case 'ContinueStatement':
    case 'ArrayPattern':
    case 'RestElement':
    case 'ImportSpecifier':
    case 'ImportDefaultSpecifier':
    case 'ImportNamespaceSpecifier':
    case 'CatchClause':
      return false;

    case 'FunctionDeclaration':
    case 'ComponentDeclaration':
    case 'HookDeclaration':
    case 'FunctionExpression':
    case 'ArrowFunctionExpression':
    case 'ClassDeclaration':
    case 'ClassExpression':
    case 'VariableDeclarator':
      return parent.id !== node;

    case 'Property':
    case 'PropertyDefinition':
    case 'MethodDefinition':
      return parent.key !== node || parent.computed || parent.shorthand;

    case 'AssignmentPattern':
      return parent.key !== node;

    default:
      return true;
  }
}
Checks that a given identifier node is a reference or not.

This is used to detect the first throwable node in a `try` block.
@param {ASTNode} node An Identifier node to check.
@returns {boolean} `true` if the node is a reference.