TS: Fix extraction of default-exported classes and functions#2093
TS: Fix extraction of default-exported classes and functions#2093semmle-qlci merged 4 commits intogithub:masterfrom
Conversation
|
LGTM, but @erik-krogh should be the one to sign off on this. |
|
(the change-notes are missing) |
erik-krogh
left a comment
There was a problem hiding this comment.
LGTM. (But as Esben mentioned, change-notes are missing, I'll approve once those are in place)
However a comment.
Your fix is to change a ClassDeclaration to a ClassExpression in the case of a default export, because that is what the existing JavaScript extractor does.
However, as one can find out by using AST explorer, it is actually a ClassDeclaration.
So the real fix would be to change the JavaScript extractor to extract a ClassDeclaration, and then get that to work with all the existing code.
However, that is a fix for the backlog.
And I think this fix is good enough that it won't bite us later.
That doesn't really matter though. Our AST was (initially) modelled after estree in which a ClassDeclaration must have an identifier. I checked the spec and AFAICT there is no semantic difference. |
|
Evaluation on typescript.slugs looks fine. |
Fixes #2051. I'm also running an evaluation just to be sure.