In order to get tracebacks that work with AOT, we need to be able to dump sourcemaps and use them again later. Putting them in a separate file is the obvious solution but that is not useful when compiling single-file executables. In addition, if the standalone executable does not contain the fennel
module itself, there's no way to run fennel.traceback
.
One potential solution is to extract fennel.traceback
similarly to fennel.view
and allow it to be included as a standalone module without bringing the entire compiler along with it.
This module could also be used as a storage location for sourcemap data. TODO: how does this actually get emitted in the Lua output in a way it can be used? Putting it at the start throws off the line numbers; putting it at he end means it won't be visible until after the code has run.