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

Keep leadingComments of CallExpression #17606

Closed
morlay opened this issue Aug 4, 2017 · 2 comments · Fixed by #22141
Closed

Keep leadingComments of CallExpression #17606

morlay opened this issue Aug 4, 2017 · 2 comments · Fixed by #22141
Assignees
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue

Comments

@morlay
Copy link

morlay commented Aug 4, 2017

TypeScript Version: 2.3.3 +

Code

export const a = /*#__PURE__*/create("a")

Expected behavior:
CallExpression.leadingComments should have comments

Actual behavior:
in https://astexplorer.net/
image

@mhegazy mhegazy added Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling labels Aug 22, 2017
@mhegazy mhegazy added this to the TypeScript 2.6 milestone Aug 22, 2017
@weswigham
Copy link
Member

weswigham commented Aug 22, 2017

This will likely continue to replicate in AST explorer as an artifact of how ast explorer looks for comments, even after we fix it in our emit as we do not directly expose comments on nodes. Specifically, The leading comments of a node never include single-line multiline comments, as it is expected those will be picked up as the trailing comments of the previous node. In this case, however, the "previous node" is the identifier on the LHS of the assignment, which, when you go the get the trailing comments for, see the = sign, then stop. There are piles of cases like this, where a comment actually falls "inside" a node, and so is not picked up by the simple-thing-to-do without knowing that, say, a token was omitted from the AST at that point and that you need to collect any comments which would be considered attached to it.

Very similar to #12985; I'll add VariableDeclaration to my list at #17689.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 31, 2018

@filipesilva mentioned he has been running into this issue as well.

@weswigham weswigham added the Fixed A PR has been merged for this issue label Mar 3, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants