Move non-logging code out of type_check_core into helpers
commitf8f32676ca3f07f30d82138b30ca9ac937d713f3
authorJake Bailey (Hacklang) <jakebailey@fb.com>
Fri, 10 May 2019 16:56:17 +0000 (10 09:56 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 10 May 2019 16:59:38 +0000 (10 09:59 -0700)
treecc18760b9cc37851a38ba6f8afce216f2e20dd68
parent6b87a4e110f2b65e1fcc80c821da9fc66ff1cf00
Move non-logging code out of type_check_core into helpers

Summary:
The type_check_core function is currently a difficult-to-follow 234-line mixture of logging and procedural logic. Local variables are numerous and it is difficult to follow when they are read or rebound.

This change moves as much logic as possible out of type_check_core into helpers, leaving type_check_core to perform logging and to serve in its existing role as a scope for the local variable soup. These helpers make it much clearer which of these variables are read and written at each step, and reduces the cognitive overhead of reading the actual logic by reducing the number of locals in scope.

Reviewed By: arxanas, dabek

Differential Revision: D10242675

fbshipit-source-id: d0e7aaa043fcfe6be5b0b82c59a33564cc161d50
hphp/hack/src/server/serverTypeCheck.ml