astor
astor copied to clipboard
Incorrect behavior during undoing the modification.
Hi @martinezmatias. This is one more thing that astor misbehaved during the repair. Actually (I think) this problem may not up to astor but Spoon. The problem happens like this.
What should be done:
| | Stmt A | | Stmt A | | Stmt A | | Stmt A
Stmt B | | Stmt B | | Stmt B | | Stmt B | | Stmt B
Stmt C | -> | Stmt C | -> | Stmt A | -> | Stmt C | -> | Stmt C
| Insert A | | Replace C | | undo | | undo |
| Before B | | With A | | 2nd op | | 1st op |
original | | variant1 | | varient2 | | variant1 | | original
However, this is what happens:
| | Stmt A | | Stmt A | | Stmt C |
Stmt B | | Stmt B | | Stmt B | | Stmt B |
Stmt C | -> | Stmt C | -> | Stmt A | -> | Stmt A | Error
| Insert A | | Replace C | | undo | | Can't find A
| Before B | | With A | | 2nd op | | inserted before B
original | | variant1 | | varient2 | | variant1 |
So when
- there is a parent variant which inserted certain statement,
- a child which replace another statement with that certain statement around that place, and
- that child failed to be a solution so operations applied needed to be undo, such case happens and makes an error there.
This problem may be triggered by bad indexing on the astor operator or may be due to the undoing operator on the Spoon library.
I'll attach my log file which contains some custom logs. You may find the error in the last part of the log file.
Hi @niMgnoeSeeL Thanks a lot for the detailed information. Amazing explanation. (If you have any suggestion/bugfix, Pull request are welcome :) ) Best regards Matias