compiler-jx: minor refactor to call a function for each compilation unit instead of putting everything directly in the loop

This function will eventually be used for a file system watcher that recompiles only changed compilation units
6 files changed