-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for dropped/extra comments #7943
Conversation
@@ -2863,6 +2889,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | |||
if (node.kind === SyntaxKind.ModuleBlock) { | |||
emitTempDeclarations(/*newLine*/ true); | |||
} | |||
|
|||
if (!!node.statements.length) { | |||
const lastStatementNode = node.statements[node.statements.length - 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a lastOrUndefined
function for these
What's the status of this PR? Does it need more work or does it need review? |
I've scrolled through the change, but didn't see the answer. Does it fix this issue (i.e. Thanks |
@mhegazy thoughts on this one? I like the emit changes |
👍 |
we will need to port this to the transforms branch. @yuit can you take care of that? |
Just noticed that this was not merged in when i made the comment. Extremely sorry for the delay. unfortunately with #5595 the emitter has fundamentally changed. the bugs do exist however. We would appreciate it if you could port this change to the new emitter. |
Fixes #2546, #6069, #6982, #7227.
Fix for #7227 is trivial - leading comments are not emitted for arrow function.
#2546 mentions two problems: comments between if block/else block and comments inside blocks (like #6069, #6982). Dropped comments were not attached to any node, so I added additonal logic in emitIfStatement & emitBlock to emit them.