Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add source mappings for serialized properties with available declaration #60005
base: main
Are you sure you want to change the base?
Add source mappings for serialized properties with available declaration #60005
Changes from 8 commits
11ebae9
c5c2fe7
3a84cca
5a8bc8b
aeaede2
4b57ecb
c25efdc
ff71ac9
5dac6a6
c8ab65c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I still feel at least a little uncomfortable with this; why isn't it declaration emit which can do this? The node builder produces lots of nodes, why doesn't this happen elsewhere?
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.
Also, can this just be done in
getPropertyNameNodeForSymbol
?(In any case, this PR is safe, since
getPropertyNameNodeForSymbol
is returning a new node.)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.
the required information is on the symbol, emit works based on the produced nodes and we need to pass somehow the information that it needs from here as this is the place where this information is being lost. This just leaves a breadcrumb that can be picked up by the emitter
maybe, im not sure sure ;p I'll try to analyze this
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.
For declaration emit nodes, just use
setTextRange
rather thansetSourceMapRange
- there's a helper in scope that takes care of a bunch of sanity checking for you that's absent here. But yeah, you should also be able to move this intogetPropertyNameNodeForSymbol
so it happens for all callers.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.
Using
setTextRange
doesn't cut it and the results are as on themain
branch. Am I using it wrong or missing something?I have moved the fix to
getPropertyNameNodeForSymbol
thoughThere 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.
Yeah, it doesn't seem to help. I don't understand why this isn't working:
So I would expect the original node stuff to "just work".
setTextRange
doesn't callsetSourceMapRange
at all, though, so...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.
If you stick
setSourceMapRange(range, location);
intosetTextRange
aftersetOriginalNode
, that actually also changes a whole bunch of other stuff kinda for the better? But then breaks some other JSDoc related code (which I think was another recent bugfix that may conflict?) Dunno if that's a good idea or not, I don't have a good mental model of this.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.
(maybe #59675?)
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.
Somewhat offtopic, somewhat not. I've wanted to verify some existing behaviors around this so I put this in the code:
and no existing test has thrown. So it seems that this has never been used on type nodes until now.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.