CensoredUsername / unrpyc

A ren'py script decompiler
Other
861 stars 157 forks source link

Correctly handle line numbers of atl_transform #103

Closed jackmcbarn closed 7 months ago

jackmcbarn commented 3 years ago

https://github.com/CensoredUsername/unrpyc/blob/2a9a9159094bf95e09c30452d5aaff46be228368/decompiler/sl2decompiler.py#L365

madeddy commented 1 year ago

So. Just for completeness the explanation whats happening there:

At the end of of sl2decompiler.py in "at transform:" is the inner function print_atl_callback executed, which goes in __init__.py in the Decompiler class. This drags the changed skip_indent_until_write=True arg from a super() command inside the dump() method in. If the next statement e.g. "parallel:" written is, the call to indent()(including a newline) in this method is accidentally skipped over. "at transform" is relative seldom used so this did fly somewhat under the radar. The commit for this happened 8 years ago: https://github.com/CensoredUsername/unrpyc/commit/528a7c4b791d5ea189428dd48412775708433915 😜

I am not sure if my commit more of tmp. hack or ok is. Maybe if skip-indent for initial newlines seldom happens, this could be set to false and the "initial newline issue" could be handled with a new code part.

CensoredUsername commented 7 months ago

With the rewrite in 577c32e now at transform actually gets put on the right line number.

CensoredUsername commented 7 months ago

Closing this as with the rewrite this issue has become outdated.