keep info about what variables are assigned in unsafe blocks
Summary:
In order to be able to properly report undefined variables in Typing, we need to traverse unsafe blocks in search of variables being defined, just like Naming currently does. This diff is a prerequisite to
D7763002 "Fix control flow in naming".
We traverse the unsafe block Nast using a visitor and gather defined variables. We deal with control flow using continuations, in a similar way as the `hack/doc/type_system/flowtypes.ml` toy.
That's a lot of lines just for unsafe blocks, but `// UNSAFE` is sometimes used for performance reasons, so we cannot run the inference algorithm on it even if we replace all types with Tany.
Besides, if we did that, the unification of type variables sometimes "leak" types out of the unsafe block, so test unsafe_block_lambda.php would fail.
Reviewed By: Wilfred
Differential Revision:
D9766253
fbshipit-source-id:
fe2cd1ddf783fd29de7885bcfff5f308634ac312