Do not try to re-clone already has origNode on CloningVisitor#1136
Closed
samsonasik wants to merge 1 commit into
Closed
Do not try to re-clone already has origNode on CloningVisitor#1136samsonasik wants to merge 1 commit into
samsonasik wants to merge 1 commit into
Conversation
Contributor
Author
|
Ready for review 👍 |
Owner
|
So rector is running CloningVisitor multiple times on the same AST? What's the reason for that? |
Contributor
Author
|
It just happen on a 1 unit test in rector-src tho (not verify other packages). I guess this may happen when multiple rules apply in a loop to revisit again until no more change. in every iterative, the |
Contributor
|
Adding an additional functional call on every node for a rector specific problem sounds like the wrong fix. I think either rector should copy and adapt this visitor or fix it in a different way |
Contributor
Author
|
@staabm Okay, closing then ;) |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On
CloningVisitor, it always try to clone itself, whenever it already hasorigNodeor not.This PR try to not re-clone when it already has an
origNodeattribute, whenever the value is set, it should already no more clone.I reproduce the re-clone on rector usage when running unit test, it got test that shows it double cloned on rector-src /cc @TomasVotruba