parse_decls rename
commite5ad91345b8e0523738d7638caed0cd4a613ab96
authorLucian Wischik <ljw@meta.com>
Sat, 15 Oct 2022 07:18:13 +0000 (15 00:18 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sat, 15 Oct 2022 07:18:13 +0000 (15 00:18 -0700)
treeab30eb780c88e9d0134eeb33accd767bebab4ed1
parent0a6e8271eb38fbf387222c28e4adffd9ebc85ac8
parse_decls rename

Summary:
These were the two functions we had before in direct_decl_parser.rs. The comments explain very clearly what each function does. However this isn't reflected in the function names. (I've added an extra apostrophe so that colorization looks good in the diff summary... :( )
```
/// Parse decls for typechecking.
/// - References the source text to avoid spending time or space copying
///   identifiers into the arena (when possible).
/// - Excludes user attributes which are irrelevant to typechecking.
pub fn parse_decls<'a'>(...)

/// Parse decls for bytecode compilation.
/// - Returns decls without reference to the source text to avoid the need to
///   keep the source text in memory when caching decls.
/// - Preserves user attributes in decls necessary for producing facts.
pub fn parse_decls_without_reference_text<'a, 'text>(...)
```

This diff renames the functions to reflect their comments:
```
pub fn parse_decls_for_typechecking<'a'>
pub fn parse_decls_for_bytecode<'a, 'text>
// also I added this one:
pub fn parse_decls_for_typechecking_without_reference_text<'a, 'text>
```

It's always a tough judgment call whether you should name functions according to what they do, or according to how they should be used. Normally I'd chose the former but in this diff I opted for the latter. My reasoning is that if the function was called "parse_decls_{with,without}_attributes_{and,or}_xml_elaboration" then almost no one would know enough context to make an informed judgment. I figured that with these names, most consumers in our team will have enough context to know what to pick.

-------

**How to review**.  The only meaningful change in this diff is in direct_decl_parser.rs. Everything else is just mechanical renaming.

Differential Revision: D40390450

fbshipit-source-id: 159a7ec4b43d8d41d894d229f7c54df0d918bd57
12 files changed:
hphp/hack/src/decl/rust_decl_ffi/rust_decl_ffi.rs
hphp/hack/src/facts/rust_facts_ffi/rust_facts_ffi.rs
hphp/hack/src/hackc/decl_provider/self_provider.rs
hphp/hack/src/hackc/ffi_bridge/compiler_ffi.rs
hphp/hack/src/hackc/hackc/compile.rs
hphp/hack/src/hackc/hackc/decls.rs
hphp/hack/src/hackc/hackc/facts.rs
hphp/hack/src/hackc/hackc/parse.rs
hphp/hack/src/hackrs/decl_parser/decl_parser.rs
hphp/hack/src/parser/api/direct_decl_parser.rs
hphp/hack/src/parser/bench/bench.rs
hphp/hack/test/decl/serialize/main.rs