Skip to content

fix: ensure parent pointers are correctly set for transformed nodes#1613

Closed
ChouUn wants to merge 0 commit intoTypeScriptToLua:masterfrom
ChouUn:master
Closed

fix: ensure parent pointers are correctly set for transformed nodes#1613
ChouUn wants to merge 0 commit intoTypeScriptToLua:masterfrom
ChouUn:master

Conversation

@ChouUn
Copy link
Contributor

@ChouUn ChouUn commented Jan 22, 2025

I've been working on writing plugins recently and encountered some issues, so I've been reading source codes of TSTL to learn more. Thus, I noticed some parts that seem a bit unreasonable.

Previously, the setParent function was applied to updatedBlock instead of result, which may lead to incorrect parent pointers in the final transformed AST. This fix ensures that parent pointers are correctly set for the final transformed node result and its subtree, maintaining the integrity of the AST during transformations.

As I am just beginning to delve into the source code, my understanding of it may not be entirely accurate. If this is an erroneous fix, please correct me and do not hesitate to explain the rationale behind your coding approach.

Copy link
Member

@Perryvw Perryvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The before and after of this code looks like they should behave identically to me. Did this actually solve the problem you were having? Can you give an example of a transformer that breaks here?

Copilot AI review requested due to automatic review settings October 28, 2025 22:01
@ChouUn ChouUn closed this Oct 28, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants