Make expand_argument_list a static function

It doesn't use any properties of parser_t
This commit is contained in:
ridiculousfish 2016-02-27 18:40:54 -08:00
parent d628fe0dea
commit 88a785e321
4 changed files with 4 additions and 5 deletions

View file

@ -1000,8 +1000,7 @@ void completer_t::complete_from_args(const wcstring &str,
} }
std::vector<completion_t> possible_comp; std::vector<completion_t> possible_comp;
const parser_t parser; parser_t::expand_argument_list(args, eflags, &possible_comp);
parser.expand_argument_list(args, eflags, &possible_comp);
if (! is_autosuggest) if (! is_autosuggest)
{ {

View file

@ -776,7 +776,7 @@ static void test_parser()
say(L"Testing eval_args"); say(L"Testing eval_args");
completion_list_t comps; completion_list_t comps;
parser_t::principal_parser().expand_argument_list(L"alpha 'beta gamma' delta", 0, &comps); parser_t::expand_argument_list(L"alpha 'beta gamma' delta", 0, &comps);
do_test(comps.size() == 3); do_test(comps.size() == 3);
do_test(comps.at(0).completion == L"alpha"); do_test(comps.at(0).completion == L"alpha");
do_test(comps.at(1).completion == L"beta gamma"); do_test(comps.at(1).completion == L"beta gamma");

View file

@ -465,7 +465,7 @@ void parser_t::emit_profiling(const char *path) const
} }
} }
void parser_t::expand_argument_list(const wcstring &arg_list_src, expand_flags_t eflags, std::vector<completion_t> *output_arg_list) const void parser_t::expand_argument_list(const wcstring &arg_list_src, expand_flags_t eflags, std::vector<completion_t> *output_arg_list)
{ {
assert(output_arg_list != NULL); assert(output_arg_list != NULL);

View file

@ -309,7 +309,7 @@ public:
\param flags Some expand flags to use \param flags Some expand flags to use
\param output List to insert output into \param output List to insert output into
*/ */
void expand_argument_list(const wcstring &arg_src, expand_flags_t flags, std::vector<completion_t> *output) const; static void expand_argument_list(const wcstring &arg_src, expand_flags_t flags, std::vector<completion_t> *output);
/** /**
Returns a string describing the current parser pisition in the format 'FILENAME (line LINE_NUMBER): LINE'. Returns a string describing the current parser pisition in the format 'FILENAME (line LINE_NUMBER): LINE'.