Fix constructor code when there is code between prologue statements and super call#48765
Merged
Conversation
…statements and super call
p-szm
commented
Apr 19, 2022
| ...existingPrologue, | ||
| ...prologue, | ||
| ...(superStatementIndex <= existingPrologue.length ? emptyArray : visitNodes(constructor.body.statements, visitor, isStatement, existingPrologue.length, superStatementIndex)), | ||
| ...(superStatementIndex <= existingPrologue.length ? emptyArray : visitNodes(constructor.body.statements, visitor, isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), |
Contributor
Author
There was a problem hiding this comment.
The last argument is count and not end, so I believe the fix is to substract the start position from here. Otherwise we're processing too many nodes (including super())
jakebailey
approved these changes
Apr 19, 2022
Contributor
Author
|
@jakebailey any chance we can port this to 4.6.x? Maybe together with #48671 which is related. It's currently blocking my team from upgrading to 4.6.x |
Member
|
Yes, I think both should be backported. @DanielRosenwasser |
This was referenced Apr 19, 2022
Member
|
@typescript-bot cherry-pick this to release-4.6 |
Collaborator
|
Heya @jakebailey, I've started to run the task to cherry-pick this into |
Collaborator
|
Hey @jakebailey, I've opened #48780 for you. |
typescript-bot
pushed a commit
to typescript-bot/TypeScript
that referenced
this pull request
Apr 20, 2022
Component commits: 1b9a9d8 Fix transformed constructor code when there is code between prologue statements and super call
Jack-Works
pushed a commit
to Jack-Works/TypeScript
that referenced
this pull request
Apr 22, 2022
…statements and super call (microsoft#48765)
DanielRosenwasser
pushed a commit
that referenced
this pull request
May 3, 2022
Component commits: 1b9a9d8 Fix transformed constructor code when there is code between prologue statements and super call Co-authored-by: Patrick Szmucer <pszmucer@palantir.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Fixes #48761
cc @JoshuaKGoldberg