Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

AntonTolmachev
Copy link

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.

@@ -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];
Copy link
Member

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

@evmar
Copy link
Contributor

evmar commented Jul 7, 2016

What's the status of this PR? Does it need more work or does it need review?

@RussKie
Copy link
Member

RussKie commented Aug 17, 2016

I've scrolled through the change, but didn't see the answer.

Does it fix this issue (i.e. lost_commentX are gone)?

Thanks

@RyanCavanaugh
Copy link
Member

@mhegazy thoughts on this one? I like the emit changes

@mhegazy
Copy link
Contributor

mhegazy commented Aug 17, 2016

👍

@mhegazy
Copy link
Contributor

mhegazy commented Aug 17, 2016

we will need to port this to the transforms branch. @yuit can you take care of that?

@mhegazy
Copy link
Contributor

mhegazy commented Sep 13, 2016

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.
Since it is not possible to manually merge this change because of the rewrite, I will go ahead and close this PR. sorry again for the delay, and hopefully future PRs would not need to wait this long to get merged in.

@mhegazy mhegazy closed this Sep 13, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants