ast-types icon indicating copy to clipboard operation
ast-types copied to clipboard

`export default class {}` breaks scope analysis

Open tchetwin opened this issue 6 years ago • 2 comments

The lack of .id in an export ClassDeclaration causes a throw in scope analysis:

https://runkit.com/embed/rz8r6io0kclh (compares with and without providing a name)

The throw originates from:

https://github.com/benjamn/ast-types/blob/a7eaba5ecc79a58acb469cbbf9fe7603cec9f57e/lib/scope.js#L240

I suspect the fix might be the same as for FunctionDeclaration a couple of lines before, haven't verified this yet:

https://github.com/benjamn/ast-types/blob/a7eaba5ecc79a58acb469cbbf9fe7603cec9f57e/lib/scope.js#L235

Edit: I have a patch for this locally with a test, seeking approval to send the PR.

tchetwin avatar Dec 18 '18 11:12 tchetwin

pinging about this

mheiber avatar Aug 01 '19 10:08 mheiber

This appears to have been fixed by #467

acutmore avatar Oct 03 '23 10:10 acutmore