Page MenuHomePhabricator

Frontend: Refactor compileModuleAndReadAST, NFC

Authored by dexonsmith on Jan 27 2021, 6:34 PM.



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.

Diff Detail

Event Timeline

dexonsmith created this revision.Jan 27 2021, 6:34 PM
dexonsmith requested review of this revision.Jan 27 2021, 6:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2021, 6:34 PM
This revision is now accepted and ready to land.Feb 3 2021, 9:19 AM