Closed jackmcbarn closed 9 years ago
The innards for this have been added in codegen, it now has an option to try to keep lineno's matching (this won't be perfect if the ast is broken though, but it'll try its hardest.). It should however guarantee that the result is valid python.
Due to some more bugs in Ren'Py I found while finishing up implementing this, it looks like I need one more feature. Can you make codegen give some indication of whether its output is all one logical line (i.e. is compatible with "$" and not just "python:")?
Considering what ren'py thinks what's a logical line vs what is actually a logical line, I'd say just run the result through util.split_logical_lines. (or for performance make a variant which just detects if there are multiple logical lines in something)
When decompiling SL1 screens, python blocks' linenumbers are wrong, since codegen doesn't respect the Python AST's line numbers when generating source code.