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;
if (function_exists(funcname, parser)) {
auto props = function_get_properties(funcname);
auto props = function_get_props(funcname);
path = function_get_definition_file(funcname);
if (path) {
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 {
assert(p->type == process_type_t::function);
auto props = function_get_properties(p->argv0());
auto props = function_get_props(p->argv0());
if (!props) {
FLOGF(error, _(L"Unknown function '%ls'"), p->argv0());
return proc_performer_t{};

View File

@ -158,7 +158,7 @@ void function_add(wcstring name, std::shared_ptr<function_properties_t> props) {
(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;
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) {
auto props = function_get_properties(name);
auto props = function_get_props(name);
if (!props) return false;
// 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) {
if (auto props = function_get_properties(name)) {
if (auto props = function_get_props(name)) {
out_desc = _(props->description.c_str());
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) {
if (auto func = function_get_properties(name)) {
if (auto func = function_get_props(name)) {
return func->definition_file;
}
return nullptr;
}
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 false;
@ -353,7 +353,7 @@ wcstring functions_def(const wcstring &name) {
out.append(esc_desc);
}
auto props = function_get_properties(name);
auto props = function_get_props(name);
assert(props && "Should have function properties");
if (!props->shadow_scope) {
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.
void function_remove(const wcstring &name);
/// Returns the properties for a function, or nullptr if none. This does not trigger autoloading.
function_properties_ref_t function_get_properties(const wcstring &name);
/// \return the properties for a function, or nullptr if none. This does not trigger autoloading.
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
/// successful, false if no function with the given name exists.