Rename function_get_properties to function_get_props

We're calling it a lot so let's make it shorter.
This commit is contained in:
ridiculousfish 2021-10-21 14:32:35 -07:00
parent 089da2314d
commit 7d7b930b08
4 changed files with 10 additions and 10 deletions

View File

@ -144,7 +144,7 @@ static int report_function_metadata(const wchar_t *funcname, bool verbose, io_st
int line_number = 0; int line_number = 0;
if (function_exists(funcname, parser)) { if (function_exists(funcname, parser)) {
auto props = function_get_properties(funcname); auto props = function_get_props(funcname);
path = function_get_definition_file(funcname); path = function_get_definition_file(funcname);
if (path) { if (path) {
autoloaded = function_is_autoloaded(funcname) ? L"autoloaded" : L"not-autoloaded"; autoloaded = function_is_autoloaded(funcname) ? L"autoloaded" : L"not-autoloaded";

View File

@ -657,7 +657,7 @@ static proc_performer_t get_performer_for_process(process_t *p, job_t *job,
}; };
} else { } else {
assert(p->type == process_type_t::function); assert(p->type == process_type_t::function);
auto props = function_get_properties(p->argv0()); auto props = function_get_props(p->argv0());
if (!props) { if (!props) {
FLOGF(error, _(L"Unknown function '%ls'"), p->argv0()); FLOGF(error, _(L"Unknown function '%ls'"), p->argv0());
return proc_performer_t{}; return proc_performer_t{};

View File

@ -158,7 +158,7 @@ void function_add(wcstring name, std::shared_ptr<function_properties_t> props) {
(void)ins; (void)ins;
} }
function_properties_ref_t function_get_properties(const wcstring &name) { function_properties_ref_t function_get_props(const wcstring &name) {
if (parser_keywords_is_reserved(name)) return nullptr; if (parser_keywords_is_reserved(name)) return nullptr;
return function_set.acquire()->get_props(name); return function_set.acquire()->get_props(name);
} }
@ -204,7 +204,7 @@ void function_remove(const wcstring &name) {
} }
bool function_get_definition(const wcstring &name, wcstring &out_definition) { bool function_get_definition(const wcstring &name, wcstring &out_definition) {
auto props = function_get_properties(name); auto props = function_get_props(name);
if (!props) return false; if (!props) return false;
// We want to preserve comments that the AST attaches to the header (#5285). // We want to preserve comments that the AST attaches to the header (#5285).
@ -221,7 +221,7 @@ bool function_get_definition(const wcstring &name, wcstring &out_definition) {
} }
bool function_get_desc(const wcstring &name, wcstring &out_desc) { bool function_get_desc(const wcstring &name, wcstring &out_desc) {
if (auto props = function_get_properties(name)) { if (auto props = function_get_props(name)) {
out_desc = _(props->description.c_str()); out_desc = _(props->description.c_str());
return true; return true;
} }
@ -279,14 +279,14 @@ wcstring_list_t function_get_names(int get_hidden) {
} }
const wchar_t *function_get_definition_file(const wcstring &name) { const wchar_t *function_get_definition_file(const wcstring &name) {
if (auto func = function_get_properties(name)) { if (auto func = function_get_props(name)) {
return func->definition_file; return func->definition_file;
} }
return nullptr; return nullptr;
} }
bool function_is_autoloaded(const wcstring &name) { bool function_is_autoloaded(const wcstring &name) {
if (auto func = function_get_properties(name)) { if (auto func = function_get_props(name)) {
return func->is_autoload; return func->is_autoload;
} }
return false; return false;
@ -353,7 +353,7 @@ wcstring functions_def(const wcstring &name) {
out.append(esc_desc); out.append(esc_desc);
} }
auto props = function_get_properties(name); auto props = function_get_props(name);
assert(props && "Should have function properties"); assert(props && "Should have function properties");
if (!props->shadow_scope) { if (!props->shadow_scope) {
out.append(L" --no-scope-shadowing"); out.append(L" --no-scope-shadowing");

View File

@ -57,8 +57,8 @@ void function_add(wcstring name, std::shared_ptr<function_properties_t> props);
/// Remove the function with the specified name. /// Remove the function with the specified name.
void function_remove(const wcstring &name); void function_remove(const wcstring &name);
/// Returns the properties for a function, or nullptr if none. This does not trigger autoloading. /// \return the properties for a function, or nullptr if none. This does not trigger autoloading.
function_properties_ref_t function_get_properties(const wcstring &name); function_properties_ref_t function_get_props(const wcstring &name);
/// Returns by reference the definition of the function with the name \c name. Returns true if /// Returns by reference the definition of the function with the name \c name. Returns true if
/// successful, false if no function with the given name exists. /// successful, false if no function with the given name exists.