mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Don't define a function if there's an error in function's args
Fixes #2519
This commit is contained in:
parent
594b460ba2
commit
ad72421b2c
1 changed files with 24 additions and 21 deletions
|
@ -2248,31 +2248,34 @@ int define_function(parser_t &parser, io_streams_t &streams, const wcstring_list
|
|||
}
|
||||
}
|
||||
|
||||
/* Here we actually define the function! */
|
||||
function_data_t d;
|
||||
|
||||
d.name = function_name;
|
||||
if (desc)
|
||||
d.description = desc;
|
||||
d.events.swap(events);
|
||||
d.shadows = shadows;
|
||||
d.named_arguments.swap(named_arguments);
|
||||
d.inherit_vars.swap(inherit_vars);
|
||||
|
||||
for (size_t i=0; i<d.events.size(); i++)
|
||||
if (!res)
|
||||
{
|
||||
event_t &e = d.events.at(i);
|
||||
e.function_name = d.name;
|
||||
}
|
||||
/* Here we actually define the function! */
|
||||
function_data_t d;
|
||||
|
||||
d.definition = contents.c_str();
|
||||
d.name = function_name;
|
||||
if (desc)
|
||||
d.description = desc;
|
||||
d.events.swap(events);
|
||||
d.shadows = shadows;
|
||||
d.named_arguments.swap(named_arguments);
|
||||
d.inherit_vars.swap(inherit_vars);
|
||||
|
||||
function_add(d, parser, definition_line_offset);
|
||||
for (size_t i=0; i<d.events.size(); i++)
|
||||
{
|
||||
event_t &e = d.events.at(i);
|
||||
e.function_name = d.name;
|
||||
}
|
||||
|
||||
// Handle wrap targets
|
||||
for (size_t w=0; w < wrap_targets.size(); w++)
|
||||
{
|
||||
complete_add_wrapper(function_name, wrap_targets.at(w));
|
||||
d.definition = contents.c_str();
|
||||
|
||||
function_add(d, parser, definition_line_offset);
|
||||
|
||||
// Handle wrap targets
|
||||
for (size_t w=0; w < wrap_targets.size(); w++)
|
||||
{
|
||||
complete_add_wrapper(function_name, wrap_targets.at(w));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue