8000 fix: ensure parent pointers are correctly set for transformed nodes by ChouUn · Pull Request #1613 · TypeScriptToLua/TypeScriptToLua · GitHub
[go: up one dir, main page]

Skip to content

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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChouUn
Copy link
@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.

Previously, the `setParent` function was applied to `updatedBlock` instead of `result`, which could 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.
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?

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.

2 participants
0