GNU bug report logs - #41676
27.0.91; js-beginning-of-defun doesn't handle ES2015 class and arrow functions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Brian Leung <bkleung89@HIDDEN>; merged with #28448; dated Tue, 2 Jun 2020 22:07:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Forcibly Merged 28448 41676. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Jun 2020 22:06:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 02 18:06:33 2020
Received: from localhost ([127.0.0.1]:41216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jgF3J-0005ar-Dk
	for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 18:06:33 -0400
Received: from lists.gnu.org ([209.51.188.17]:49730)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bkleung89@HIDDEN>) id 1jgF3H-0005ak-W0
 for submit <at> debbugs.gnu.org; Tue, 02 Jun 2020 18:06:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50244)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bkleung89@HIDDEN>)
 id 1jgF3H-00036n-SH
 for bug-gnu-emacs@HIDDEN; Tue, 02 Jun 2020 18:06:31 -0400
Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:35241)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <bkleung89@HIDDEN>)
 id 1jgF3H-0005dA-4R
 for bug-gnu-emacs@HIDDEN; Tue, 02 Jun 2020 18:06:31 -0400
Received: by mail-ej1-x633.google.com with SMTP id y13so7590eju.2
 for <bug-gnu-emacs@HIDDEN>; Tue, 02 Jun 2020 15:06:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=BIfGOwuvGrzn2SIx1h3lrLNPjM6LJkcCQ8+VkqxUFYI=;
 b=rCyMbZD8+3daoq1IM31Ifxq2AsNGPpri/x56G6XKLEDvDhu7uun/6RTbBM9NhqDZ6r
 RR3iAmhi77A8cKLvbttFYrrjan71iaJs1uprHmCgo/4n8C8YYwEWjH1gp4zipWQWuIW5
 fFnTJoxiXRxpkzWhQJc/7oXfJnllpkY4v4Feq/cPGckgAQ/0JMD+N+nRM9+BAoTv0++2
 dvIMJhlR7pUWvDy6do0+o1/FJGIneaPOUVpt+V0Tfp205OR7jVMxruysM74q+SWKZFUi
 e5P+RnMGT5pOnc+yFdYJ3jrXDpnOhewdU8cTYr7u99S806VrjebkPiQPjUHAXXgzVrl/
 9+Dg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=BIfGOwuvGrzn2SIx1h3lrLNPjM6LJkcCQ8+VkqxUFYI=;
 b=E7cMH5YFLXLeBPhAQMFBouGtTEA88DZ4dNjdzLQEJV7zOO92CBAHaWNFUxAt+pOFC2
 F/TB8gGZCgRgbbLsv0zMUGVjq2SGaHd4D91rN4tKly+xWWNqQKawPMNB3luBQptsgRk+
 xZH/+eo2dA/JFA4VKE8DWQGulcbuqG3U1V5SzT2Hbhb0dOueQhVnKAgzJsT82H0AIBgA
 tAmDaRxTNrhcvNGqBfCxBVY6laP+pALoQ4wuVrXbxU+j5asOEJbqy4ln2oes/VhTcYRx
 i9t8l17o/QHZdheDHQ5gdTpZpmAnRWuSa9R963E4pzyQulAJxIDsuys3OErXx93bzDEw
 HEbw==
X-Gm-Message-State: AOAM533sLGCMZz2XVyRGPqKFNSs5l61Vsvkf2sEzrbLRI50IEm/qXjnQ
 YvcP3UpHa/XpTuYnGqIu+5MQOnjv+XpIWacM5Y0QkLBT
X-Google-Smtp-Source: ABdhPJyylrR+AhsJB0qLYM8N6ZignhK5pJ4TJ0C9b1Ng+gCVlx9elkDAkPKGUXIx0l/KGtbg+5xsG1RsdBuvRNydZ80=
X-Received: by 2002:a17:907:10d1:: with SMTP id
 rv17mr20855925ejb.51.1591135588621; 
 Tue, 02 Jun 2020 15:06:28 -0700 (PDT)
MIME-Version: 1.0
From: Brian Leung <bkleung89@HIDDEN>
Date: Tue, 2 Jun 2020 15:05:52 -0700
Message-ID: <CAAc=MEzkr0ik9aczrxk0dGGOR8fs3M33uf07vymX+w=BEy0L8w@HIDDEN>
Subject: 27.0.91;
 js-beginning-of-defun doesn't handle ES2015 class and arrow functions
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="0000000000008ca1f305a7211f3a"
Received-SPF: pass client-ip=2a00:1450:4864:20::633;
 envelope-from=bkleung89@HIDDEN; helo=mail-ej1-x633.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

--0000000000008ca1f305a7211f3a
Content-Type: text/plain; charset="UTF-8"

In the following ES2015 file:

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

class Abc extends React.Component {}

const App = () => {
  return (
    <div>
      <h1 id="5">Hi</h1>
    </div>
  );
};

function abc(x) {
  return 42;
}

const def = () => {
  return 1;
};

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



If you start at the end and use M-: js-beginning-of-defun repeatedly
(necessary since in bug #41469 it's clear that
beginning-of-defun-function is c-beginning-of-defun), point stops at the
ES5 function declaration of abc and then at the imports section,
skipping the arrow functions and the class declaration.

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)

--0000000000008ca1f305a7211f3a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">In the following ES2015 file:<br><br>import * as React fro=
m &quot;react&quot;;<br>import { render } from &quot;react-dom&quot;;<br>im=
port SearchParams from &quot;./SearchParams&quot;;<br><br>class Abc extends=
 React.Component {}<br><br>const App =3D () =3D&gt; {<br>=C2=A0 return (<br=
>=C2=A0 =C2=A0 &lt;div&gt;<br>=C2=A0 =C2=A0 =C2=A0 &lt;h1 id=3D&quot;5&quot=
;&gt;Hi&lt;/h1&gt;<br>=C2=A0 =C2=A0 &lt;/div&gt;<br>=C2=A0 );<br>};<br><br>=
function abc(x) {<br>=C2=A0 return 42;<br>}<br><br>const def =3D () =3D&gt;=
 {<br>=C2=A0 return 1;<br>};<br><br>render(&lt;App /&gt;, document.getEleme=
ntById(&quot;root&quot;));<br><br><br><br>If you start at the end and use M=
-: js-beginning-of-defun repeatedly<br>(necessary since in bug #41469 it&#3=
9;s clear that<br>beginning-of-defun-function is c-beginning-of-defun), poi=
nt stops at the<br>ES5 function declaration of abc and then at the imports =
section,<br>skipping the arrow functions and the class declaration.<br><br>=
In GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)<b=
r>Windowing system distributor &#39;The X.Org Foundation&#39;, version 11.0=
.12008000<br>System Description: NixOS 20.09 (Nightingale)<br></div>

--0000000000008ca1f305a7211f3a--




Acknowledgement sent to Brian Leung <bkleung89@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#41676; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 8 May 2022 12:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.