mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-23 08:11:11 -03:00
Simplify function_info_t and function_data_t
Work towards cleaning up function definition. Migrate inherit_vars into props and capture their values at the point of definition.
This commit is contained in:
@@ -213,15 +213,11 @@ static wcstring functions_def(const wcstring &name) {
|
||||
}
|
||||
|
||||
// Output any inherited variables as `set -l` lines.
|
||||
std::map<wcstring, env_var_t> inherit_vars = function_get_inherit_vars(name);
|
||||
for (const auto &kv : inherit_vars) {
|
||||
wcstring_list_t lst;
|
||||
kv.second.to_list(lst);
|
||||
|
||||
for (const auto &kv : props->inherit_vars) {
|
||||
// We don't know what indentation style the function uses,
|
||||
// so we do what fish_indent would.
|
||||
append_format(out, L"\n set -l %ls", kv.first.c_str());
|
||||
for (const auto &arg : lst) {
|
||||
for (const auto &arg : kv.second) {
|
||||
wcstring earg = escape_string(arg, ESCAPE_ALL);
|
||||
out.push_back(L' ');
|
||||
out.append(earg);
|
||||
|
||||
Reference in New Issue
Block a user