Rename elaborate_id and remove unnecessary arguments
commit1cb0fc9fd3bc5aa3d1cd2e50b74e6b4a195a5000
authorThomas Jiang <thomasjiang@fb.com>
Fri, 1 Nov 2019 20:58:23 +0000 (1 13:58 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 1 Nov 2019 21:03:20 +0000 (1 14:03 -0700)
treede387cff7222006b6be945dca5a2368a23b15e8d
parent40801cb1a14ad4c2e9b76f59515dc32e2b2ae95a
Rename elaborate_id and remove unnecessary arguments

Summary:
The diffs below this one have effectively removed all namespace elaboration from the emitter into a separate pass.

This means that `hhbc_id.ml` should not contain any namespace elaboration. Which means that we can clean up the `Hhbc_id` API a little.

Now, instead of elaborating the id, `elaborate_id` just strips the leading `\` in most cases.

We no longer need `elaborate_id` for Function, Const, and Record. For the cases where we are taking the elaborated name and going from `ast.id -> t`, replace with `from_ast_name` which already strips the leading `\`. For the cases where we were calling `elaborate_id |> to_raw_string` for emitter special transformation purposes, we can just use `Hhbc_string_utils.strip_global_ns` there directly.

Note: We still use `elaborate_id` for Class as we do XHP mangling there.

Additionally, since we no longer require the `namespace_env` in many places, we can clean up a lot of interfaces by removing the threading of either `env` or `namespace`. That's the majority of the diff.

Reviewed By: kmeht

Differential Revision: D18075817

fbshipit-source-id: aa2b037dd0aa880f0bd85995293a86c5f7436d6c
26 files changed:
hphp/hack/src/hhbc/ast_constant_folder.ml
hphp/hack/src/hhbc/closure_convert.ml
hphp/hack/src/hhbc/emit_attribute.ml
hphp/hack/src/hhbc/emit_body.ml
hphp/hack/src/hhbc/emit_body.mli
hphp/hack/src/hhbc/emit_class.ml
hphp/hack/src/hhbc/emit_expression.ml
hphp/hack/src/hhbc/emit_function.ml
hphp/hack/src/hhbc/emit_memoize_function.ml
hphp/hack/src/hhbc/emit_memoize_method.ml
hphp/hack/src/hhbc/emit_method.ml
hphp/hack/src/hhbc/emit_native_opcode.ml
hphp/hack/src/hhbc/emit_param.ml
hphp/hack/src/hhbc/emit_property.ml
hphp/hack/src/hhbc/emit_record_def.ml
hphp/hack/src/hhbc/emit_statement.ml
hphp/hack/src/hhbc/emit_type_constant.ml
hphp/hack/src/hhbc/emit_type_hint.ml
hphp/hack/src/hhbc/emit_type_hint.mli
hphp/hack/src/hhbc/emit_typedef.ml
hphp/hack/src/hhbc/emit_xhp.ml
hphp/hack/src/hhbc/hhbc_hhas.ml
hphp/hack/src/hhbc/hhbc_id.ml
hphp/hack/src/hhbc/hhbc_id.mli
hphp/hack/src/hhbc/interceptable.ml
hphp/hack/src/hhbc/try_finally_rewriter.ml