From d628fe0deaa134efa1205a25e538f3cb828661a0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 27 Feb 2016 18:37:59 -0800 Subject: Eliminate parser_t::show_errors Errors are now unconditionally shown --- src/parser.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 325b053d..aa99a69b 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -162,8 +162,7 @@ static wcstring user_presentable_path(const wcstring &path) } -parser_t::parser_t(bool errors) : - show_errors(errors), +parser_t::parser_t() : cancellation_requested(false), is_within_fish_initialization(false) { @@ -176,7 +175,7 @@ parser_t &parser_t::principal_parser(void) { ASSERT_IS_NOT_FORKED_CHILD(); ASSERT_IS_MAIN_THREAD(); - static parser_t parser(true); + static parser_t parser; if (! s_principal_parser) { s_principal_parser = &parser; @@ -466,11 +465,9 @@ 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 *output_arg_list) +void parser_t::expand_argument_list(const wcstring &arg_list_src, expand_flags_t eflags, std::vector *output_arg_list) const { assert(output_arg_list != NULL); - if (! show_errors) - eflags |= EXPAND_NO_DESCRIPTIONS; /* Parse the string as an argument list */ parse_node_tree_t tree; @@ -831,17 +828,14 @@ int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t /* Parse the source into a tree, if we can */ parse_node_tree_t tree; parse_error_list_t error_list; - if (! parse_tree_from_string(cmd, parse_flag_none, &tree, this->show_errors ? &error_list : NULL)) + if (! parse_tree_from_string(cmd, parse_flag_none, &tree, &error_list)) { - if (this->show_errors) - { - /* Get a backtrace */ - wcstring backtrace_and_desc; - this->get_backtrace(cmd, error_list, &backtrace_and_desc); + /* Get a backtrace. This includes the message. */ + wcstring backtrace_and_desc; + this->get_backtrace(cmd, error_list, &backtrace_and_desc); - /* Print it */ - fprintf(stderr, "%ls", backtrace_and_desc.c_str()); - } + /* Print it */ + fprintf(stderr, "%ls", backtrace_and_desc.c_str()); return 1; } -- cgit v1.2.3