This renames compileModuleAndReadAST, adding a BehindLock suffix,
and refactors it to significantly reduce nesting.
- Split out helpers compileModuleAndReadASTImpl and readASTAfterCompileModule which have straight-line code that doesn't worry about locks.
- Use break in the interesting cases of switch statements to reduce nesting.
- Use early returns to reduce nesting.
Detangling the compile-and-read logic from the check-for-locks logic
should be a net win for readability, although I also have a side
motivation of making the locks optional in a follow-up.
No functionality change here.