use an empty filename when re-parsing source files
In printFile, we print and re-parse the modified AST to be able to have reliable position information. The re-parsing step can fail if something goes very wrong, such as a bug in -literals. It should generally not happen. However, in rare cases it has happened, and it's confusing for the end user to see syntax errors pointing at an existing file on disk, when the code doesn't align - since we're on a modified copy. To prevent such confusion, use an empty filename. Syntax errors will still not be terribly helpful, but they should be extremely rare and promptly fixed, so that's not a huge concern. For that same reason, we can't really add a good test here. We could perhaps add a test that forces garble to mess up the src slice in some way, but that would be a weird test, and not particularly worth it. Fixes #286.pull/336/head
parent
8961e0a39a
commit
2ef9386942
Loading…
Reference in New Issue