Subject: 27.0.91; beginning-of-defun doesn't work inside React markup in js-jsx-mode

From: Brian Leung <[email-masked]>
Date: Mon, 1 Jun 2020 10:59:50 -0700

With a file App.js that looks like:

import * as React from "react";
import { render } from "react-dom";

const App = () => {
  return (
    <div>
      <h1 id="abc">hello</h1>
      <SearchParams />
    </div>
  );
};

render(<App />, document.getElementById("root"));

If you open the file in JS mode (Emacs 27), and move point inside of
"abc", calling

M-: (c-beginning-of-defun)

gives the following error:

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  copy-hash-table(nil)
  c-forward-<>-arglist(nil)
  c-backward-<>-arglist(nil nil)
  c-looking-at-decl-block(99 nil)
  c-most-enclosing-decl-block((117 99 88 (40 . 50)))
  c-widen-to-enclosing-decl-scope((117 99 88 (40 . 50)) 1 234)
  c-beginning-of-defun()
  eval((c-beginning-of-defun) t)
  eval-expression((c-beginning-of-defun) nil nil 127)
  funcall-interactively(eval-expression (c-beginning-of-defun) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Manually invoking C-M-a inside the double quotes should end the same way.

In GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: NixOS 20.09 (Nightingale)