Naming_provider takes backend not ctx
commitdeef5b54fa37ddb4097e3d9a2886ee95d386470b
authorLucian Wischik <ljw@fb.com>
Sat, 4 Apr 2020 14:53:18 +0000 (4 07:53 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sat, 4 Apr 2020 15:09:31 +0000 (4 08:09 -0700)
treed1d4520019ae84e8e324425755e62942c6d063a1
parent69678525c7f5aa2c7653de73ecdfcbf052e163de
Naming_provider takes backend not ctx

Summary:
This diff is non-trivial. (It's just a trivial change of signatures, a minor refactoring, but it's non-trivial because of its implications).

Currently sIDE operates on a ctx. But this ctx has a complex role - (1) as a cache of ASTs and TASTs for all open files, (2) as context for TAST computation, (3) as a holder of forward-naming-table, (4) as a holder of local-memory backend including reverse-naming-table, (5) as a holder of tcopt and popt.

I need to disentangle roles (1) and (2). The way I'll do that in the type system is by making sIDE no longer store  `ctx` in its state, since it would be ambiguous whether it was storing this ctx for (1) or for (2). Therefore, roles (3,4,5) have to be separated as well.

This has knock-on effects. The naming table updates will work with (3,4,5) but not with (1/2). Therefore, I'm changing the signature of relevant naming-table functions so they take `backend` explicitly (which they need to get at its reverse-namign-table) rather than `ctx`.

On the one hand it's a shame that the lovely ctx abstraction can't just exist universally. On the other hand, it's perhaps a nice bit of rigor that the Naming_provider and Namign_table functions now explicitly indicate which aspects of ctx they depend upon.

Reviewed By: arxanas

Differential Revision: D20834153

fbshipit-source-id: b43d132d3c0e085110590a1bc9eae98b20b93243
hphp/hack/src/client/ide_service/clientIdeIncremental.ml
hphp/hack/src/naming/naming_global.ml
hphp/hack/src/naming/naming_table.ml
hphp/hack/src/providers/naming_provider.ml
hphp/hack/src/providers/naming_provider.mli
hphp/hack/src/server/serverLazyInit.ml