-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Move legacy decorators into separate transform #48669
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
Conversation
3 > ^^^ | ||
4 > ^^^^^^^^^^ | ||
5 > ^ | ||
3 > ^^^^^^^^^^^^^ |
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.
This shouldnt have changed right? i mean we do want =
as separate thing in sourcemap ?
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.
This is a consequence of performing transforms in two steps where we first remove the modifiers (in the ts
transform), and then remove the decorators (in the legacyDecorators
transform). It's not the =
that is mapped here, but rather the start of the function expression that is no longer mapped to the start of the private
modifier since that modifier no longer exists when the decorators transform is run. I debated accepting this change, but modifiers aren't a valid position for an inline breakpoint so this doesn't seem to affect the debug experience.
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.
It turns out the information is available, since the decorators
and modifiers
arrays exist and have a pos/end but are empty. The issue is that moveRangePastDecorators
and moveRangePastModifiers
only use the end
of a NodeArray
if the array isn't empty. I may be able to change that to get the necessary information to insert a valid source map position here.
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've pushed up a change to address this. There are still changes to the sourcemap emit, but these changes should be an improvement as the mappings are more consistent.
dc52855
to
2ca0e72
Compare
2ca0e72
to
50fa541
Compare
@sheetalkamat can you take another look? |
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.
Does this need to go into 4.8 fairly early to see if it's breaky? It looks fine to me currently.
That would be my preference yes. The sooner we can get feedback on any issues with the API changes, the better. |
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.
Looks good to me. @sheetalkamat can you take another look too?
This moves the portion of the
ts
transform that handles decorators to a separate transformer to pave the way for eventual support for native ECMAScript decorators now that the proposal has reached Stage 3.