mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Fixed named_arguments to be wcstring_list_t instead of al_list
This commit is contained in:
parent
d3311c81e5
commit
f891ea5713
3 changed files with 13 additions and 15 deletions
15
builtin.cpp
15
builtin.cpp
|
@ -1456,7 +1456,9 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
|
||||||
int res=STATUS_BUILTIN_OK;
|
int res=STATUS_BUILTIN_OK;
|
||||||
wchar_t *desc=0;
|
wchar_t *desc=0;
|
||||||
std::vector<event_t> events;
|
std::vector<event_t> events;
|
||||||
array_list_t *named_arguments=0;
|
|
||||||
|
std::auto_ptr<wcstring_list_t> named_arguments(NULL);
|
||||||
|
|
||||||
wchar_t *name = 0;
|
wchar_t *name = 0;
|
||||||
int shadows = 1;
|
int shadows = 1;
|
||||||
|
|
||||||
|
@ -1651,8 +1653,8 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
if( !named_arguments )
|
if( named_arguments.get() == NULL )
|
||||||
named_arguments = al_halloc( parser.current_block );
|
named_arguments.reset(new wcstring_list_t);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
|
@ -1706,7 +1708,7 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
|
||||||
|
|
||||||
name = argv[woptind++];
|
name = argv[woptind++];
|
||||||
|
|
||||||
if( named_arguments )
|
if( named_arguments.get() )
|
||||||
{
|
{
|
||||||
while( woptind < argc )
|
while( woptind < argc )
|
||||||
{
|
{
|
||||||
|
@ -1720,7 +1722,7 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
al_push( named_arguments, halloc_wcsdup( parser.current_block, argv[woptind++] ) );
|
named_arguments->push_back(argv[woptind++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( woptind != argc )
|
else if( woptind != argc )
|
||||||
|
@ -1773,8 +1775,9 @@ static int builtin_function( parser_t &parser, wchar_t **argv )
|
||||||
d->name=halloc_wcsdup( parser.current_block, name);
|
d->name=halloc_wcsdup( parser.current_block, name);
|
||||||
d->description=desc?halloc_wcsdup( parser.current_block, desc):0;
|
d->description=desc?halloc_wcsdup( parser.current_block, desc):0;
|
||||||
d->events.swap(events);
|
d->events.swap(events);
|
||||||
d->named_arguments = named_arguments;
|
|
||||||
d->shadows = shadows;
|
d->shadows = shadows;
|
||||||
|
if (named_arguments.get())
|
||||||
|
d->named_arguments.swap(*named_arguments);
|
||||||
|
|
||||||
for( size_t i=0; i<d->events.size(); i++ )
|
for( size_t i=0; i<d->events.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
11
function.cpp
11
function.cpp
|
@ -173,14 +173,9 @@ void function_add( function_data_t *data, const parser_t &parser )
|
||||||
info->definition_offset = parse_util_lineno( parser.get_buffer(), parser.current_block->tok_pos )-1;
|
info->definition_offset = parse_util_lineno( parser.get_buffer(), parser.current_block->tok_pos )-1;
|
||||||
info->definition = data->definition;
|
info->definition = data->definition;
|
||||||
|
|
||||||
if( data->named_arguments )
|
if (! data->named_arguments.empty()) {
|
||||||
{
|
info->named_arguments.insert(info->named_arguments.end(), data->named_arguments.begin(), data->named_arguments.end());
|
||||||
for( size_t i=0; i<al_get_count( data->named_arguments ); i++ )
|
}
|
||||||
{
|
|
||||||
info->named_arguments.push_back((wchar_t *)al_get( data->named_arguments, i ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (data->description)
|
if (data->description)
|
||||||
info->description = data->description;
|
info->description = data->description;
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct function_data_t
|
||||||
/**
|
/**
|
||||||
List of all named arguments for this function
|
List of all named arguments for this function
|
||||||
*/
|
*/
|
||||||
array_list_t *named_arguments;
|
wcstring_list_t named_arguments;
|
||||||
/**
|
/**
|
||||||
Set to non-zero if invoking this function shadows the variables
|
Set to non-zero if invoking this function shadows the variables
|
||||||
of the underlying function.
|
of the underlying function.
|
||||||
|
|
Loading…
Reference in a new issue