mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
[cppcheck] add const in several places
Found with constParameter, functionConst, constVariable, constArgument Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
39861d54c5
commit
fee08a87e9
19 changed files with 53 additions and 53 deletions
|
@ -152,7 +152,7 @@ int parse_help_only_cmd_opts(struct help_only_cmd_opts_t &opts, int *optind, int
|
|||
/// builtin or function name to get up help for
|
||||
///
|
||||
/// Process and print help for the specified builtin or function.
|
||||
void builtin_print_help(parser_t &parser, io_streams_t &streams, const wchar_t *name,
|
||||
void builtin_print_help(parser_t &parser, const io_streams_t &streams, const wchar_t *name,
|
||||
wcstring *error_message) {
|
||||
UNUSED(streams);
|
||||
// This won't ever work if no_exec is set.
|
||||
|
|
|
@ -89,7 +89,7 @@ const wchar_t *builtin_get_desc(const wcstring &name);
|
|||
|
||||
wcstring builtin_help_get(parser_t &parser, const wchar_t *cmd);
|
||||
|
||||
void builtin_print_help(parser_t &parser, io_streams_t &streams, const wchar_t *name,
|
||||
void builtin_print_help(parser_t &parser, const io_streams_t &streams, const wchar_t *name,
|
||||
wcstring *error_message = nullptr);
|
||||
int builtin_count_args(const wchar_t *const *argv);
|
||||
|
||||
|
|
|
@ -643,7 +643,7 @@ static int argparse_parse_args(argparse_cmd_opts_t &opts, const wcstring_list_t
|
|||
return STATUS_CMD_OK;
|
||||
}
|
||||
|
||||
static int check_min_max_args_constraints(const argparse_cmd_opts_t &opts, parser_t &parser,
|
||||
static int check_min_max_args_constraints(const argparse_cmd_opts_t &opts, const parser_t &parser,
|
||||
io_streams_t &streams) {
|
||||
UNUSED(parser);
|
||||
const wchar_t *cmd = opts.name.c_str();
|
||||
|
|
|
@ -150,7 +150,7 @@ void builtin_bind_t::function_names(io_streams_t &streams) {
|
|||
|
||||
/// Wraps input_terminfo_get_sequence(), appending the correct error messages as needed.
|
||||
bool builtin_bind_t::get_terminfo_sequence(const wcstring &seq, wcstring *out_seq,
|
||||
io_streams_t &streams) {
|
||||
io_streams_t &streams) const {
|
||||
if (input_terminfo_get_sequence(seq, out_seq)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class builtin_bind_t {
|
|||
const wchar_t *sets_mode, bool terminfo, bool user, io_streams_t &streams);
|
||||
bool erase(wchar_t **seq, bool all, const wchar_t *mode, bool use_terminfo, bool user,
|
||||
io_streams_t &streams);
|
||||
bool get_terminfo_sequence(const wcstring &seq, wcstring *out_seq, io_streams_t &streams);
|
||||
bool get_terminfo_sequence(const wcstring &seq, wcstring *out_seq, io_streams_t &streams) const;
|
||||
bool insert(int optind, int argc, wchar_t **argv, io_streams_t &streams);
|
||||
void list_modes(io_streams_t &streams);
|
||||
bool list_one(const wcstring &seq, const wcstring &bind_mode, bool user, io_streams_t &streams);
|
||||
|
|
|
@ -56,8 +56,8 @@ static void builtin_complete_add2(const wchar_t *cmd, bool cmd_is_path, const wc
|
|||
|
||||
/// Silly function.
|
||||
static void builtin_complete_add(const wcstring_list_t &cmds, const wcstring_list_t &paths,
|
||||
const wchar_t *short_opt, wcstring_list_t &gnu_opt,
|
||||
wcstring_list_t &old_opt, completion_mode_t result_mode,
|
||||
const wchar_t *short_opt, const wcstring_list_t &gnu_opt,
|
||||
const wcstring_list_t &old_opt, completion_mode_t result_mode,
|
||||
const wchar_t *condition, const wchar_t *comp, const wchar_t *desc,
|
||||
int flags) {
|
||||
for (const wcstring &cmd : cmds) {
|
||||
|
|
|
@ -128,7 +128,7 @@ static const wchar_t *math_get_arg(int *argidx, wchar_t **argv, wcstring *storag
|
|||
return math_get_arg_argv(argidx, argv);
|
||||
}
|
||||
|
||||
static const wchar_t *math_describe_error(te_error_t &error) {
|
||||
static const wchar_t *math_describe_error(const te_error_t &error) {
|
||||
if (error.position == 0) return L"NO ERROR?!?";
|
||||
|
||||
switch (error.type) {
|
||||
|
@ -186,8 +186,8 @@ static wcstring format_double(double v, const math_cmd_opts_t &opts) {
|
|||
}
|
||||
|
||||
/// Evaluate math expressions.
|
||||
static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_t &streams,
|
||||
math_cmd_opts_t &opts, wcstring &expression) {
|
||||
static int evaluate_expression(const wchar_t *cmd, const parser_t &parser, io_streams_t &streams,
|
||||
const math_cmd_opts_t &opts, wcstring &expression) {
|
||||
UNUSED(parser);
|
||||
|
||||
int retval = STATUS_CMD_OK;
|
||||
|
|
|
@ -172,7 +172,7 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs
|
|||
return STATUS_CMD_OK;
|
||||
}
|
||||
|
||||
static int validate_cmd_opts(const wchar_t *cmd, set_cmd_opts_t &opts, //!OCLINT(npath complexity)
|
||||
static int validate_cmd_opts(const wchar_t *cmd, const set_cmd_opts_t &opts, //!OCLINT(npath complexity)
|
||||
int argc, parser_t &parser, io_streams_t &streams) {
|
||||
// Can't query and erase or list.
|
||||
if (opts.query && (opts.erase || opts.list)) {
|
||||
|
@ -235,7 +235,7 @@ static int validate_cmd_opts(const wchar_t *cmd, set_cmd_opts_t &opts, //!OCLIN
|
|||
|
||||
// Check if we are setting a uvar and a global of the same name exists. See
|
||||
// https://github.com/fish-shell/fish-shell/issues/806
|
||||
static int check_global_scope_exists(const wchar_t *cmd, set_cmd_opts_t &opts, const wchar_t *dest,
|
||||
static int check_global_scope_exists(const wchar_t *cmd, const set_cmd_opts_t &opts, const wchar_t *dest,
|
||||
io_streams_t &streams, const parser_t &parser) {
|
||||
if (opts.universal) {
|
||||
auto global_dest = parser.vars().get(dest, ENV_GLOBAL);
|
||||
|
@ -414,7 +414,7 @@ static int parse_index(std::vector<long> &indexes, wchar_t *src, int scope, io_s
|
|||
}
|
||||
|
||||
static int update_values(wcstring_list_t &list, std::vector<long> &indexes,
|
||||
wcstring_list_t &values) {
|
||||
const wcstring_list_t &values) {
|
||||
// Replace values where needed.
|
||||
for (size_t i = 0; i < indexes.size(); i++) {
|
||||
// The '- 1' below is because the indices in fish are one-based, but the vector uses
|
||||
|
@ -452,7 +452,7 @@ static void erase_values(wcstring_list_t &list, const std::vector<long> &indexes
|
|||
}
|
||||
}
|
||||
|
||||
static env_mode_flags_t compute_scope(set_cmd_opts_t &opts) {
|
||||
static env_mode_flags_t compute_scope(const set_cmd_opts_t &opts) {
|
||||
int scope = ENV_USER;
|
||||
if (opts.local) scope |= ENV_LOCAL;
|
||||
if (opts.global) scope |= ENV_GLOBAL;
|
||||
|
@ -602,10 +602,10 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
|
|||
}
|
||||
|
||||
/// Show mode. Show information about the named variable(s).
|
||||
static int builtin_set_show(const wchar_t *cmd, set_cmd_opts_t &opts, int argc, wchar_t **argv,
|
||||
static int builtin_set_show(const wchar_t *cmd, const set_cmd_opts_t &opts, int argc, wchar_t **argv,
|
||||
parser_t &parser, io_streams_t &streams) {
|
||||
UNUSED(opts);
|
||||
auto &vars = parser.vars();
|
||||
const auto &vars = parser.vars();
|
||||
if (argc == 0) { // show all vars
|
||||
wcstring_list_t names = parser.vars().get_names(ENV_USER);
|
||||
sort(names.begin(), names.end());
|
||||
|
@ -696,9 +696,9 @@ static int builtin_set_erase(const wchar_t *cmd, set_cmd_opts_t &opts, int argc,
|
|||
}
|
||||
|
||||
/// This handles the common case of setting the entire var to a set of values.
|
||||
static int set_var_array(const wchar_t *cmd, set_cmd_opts_t &opts, const wchar_t *varname,
|
||||
static int set_var_array(const wchar_t *cmd, const set_cmd_opts_t &opts, const wchar_t *varname,
|
||||
wcstring_list_t &new_values, int argc, wchar_t **argv, parser_t &parser,
|
||||
io_streams_t &streams) {
|
||||
const io_streams_t &streams) {
|
||||
UNUSED(cmd);
|
||||
UNUSED(streams);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ typedef struct { //!OCLINT(too many fields)
|
|||
} options_t;
|
||||
|
||||
/// This handles the `--style=xxx` flag.
|
||||
static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
const wchar_t *cmd = argv[0];
|
||||
|
||||
|
@ -207,7 +207,7 @@ static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->no_newline_valid) {
|
||||
opts->no_newline = true;
|
||||
|
@ -220,7 +220,7 @@ static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->all_valid) {
|
||||
opts->all = true;
|
||||
|
@ -230,7 +230,7 @@ static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->chars_valid) {
|
||||
opts->chars_to_trim = w.woptarg;
|
||||
|
@ -240,7 +240,7 @@ static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->entire_valid) {
|
||||
opts->entire = true;
|
||||
|
@ -250,7 +250,7 @@ static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->filter_valid) {
|
||||
opts->filter = true;
|
||||
|
@ -260,7 +260,7 @@ static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->ignore_case_valid) {
|
||||
opts->ignore_case = true;
|
||||
|
@ -273,7 +273,7 @@ static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->length_valid) {
|
||||
opts->length = fish_wcstol(w.woptarg);
|
||||
|
@ -293,7 +293,7 @@ static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->max_valid) {
|
||||
opts->max = fish_wcstol(w.woptarg);
|
||||
|
@ -310,7 +310,7 @@ static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->count_valid) {
|
||||
opts->count = fish_wcstol(w.woptarg);
|
||||
|
@ -336,7 +336,7 @@ static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->quiet_valid) {
|
||||
opts->quiet = true;
|
||||
|
@ -346,7 +346,7 @@ static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->regex_valid) {
|
||||
opts->regex = true;
|
||||
|
@ -359,7 +359,7 @@ static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->start_valid) {
|
||||
opts->start = fish_wcstol(w.woptarg);
|
||||
|
@ -376,7 +376,7 @@ static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
|||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
static int handle_flag_v(wchar_t **argv, parser_t &parser, io_streams_t &streams, wgetopter_t &w,
|
||||
static int handle_flag_v(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w,
|
||||
options_t *opts) {
|
||||
if (opts->invert_valid) {
|
||||
opts->invert_match = true;
|
||||
|
|
|
@ -170,7 +170,7 @@ static const named_color_t named_colors[] = {
|
|||
};
|
||||
|
||||
wcstring_list_t rgb_color_t::named_color_names() {
|
||||
size_t count = sizeof named_colors / sizeof *named_colors;
|
||||
const size_t count = sizeof named_colors / sizeof *named_colors;
|
||||
wcstring_list_t result;
|
||||
result.reserve(1 + count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
|
|
|
@ -217,12 +217,12 @@ void env_universal_callbacks(env_stack_t *stack, const callback_data_list_t &cal
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_fish_term_change(env_stack_t &vars) {
|
||||
static void handle_fish_term_change(const env_stack_t &vars) {
|
||||
update_fish_color_support(vars);
|
||||
reader_react_to_color_change();
|
||||
}
|
||||
|
||||
static void handle_change_ambiguous_width(env_stack_t &vars) {
|
||||
static void handle_change_ambiguous_width(const env_stack_t &vars) {
|
||||
int new_width = 1;
|
||||
if (auto width_str = vars.get(L"fish_ambiguous_width")) {
|
||||
new_width = fish_wcstol(width_str->as_string().c_str());
|
||||
|
@ -230,26 +230,26 @@ static void handle_change_ambiguous_width(env_stack_t &vars) {
|
|||
g_fish_ambiguous_width = std::max(0, new_width);
|
||||
}
|
||||
|
||||
static void handle_term_size_change(env_stack_t &vars) {
|
||||
static void handle_term_size_change(const env_stack_t &vars) {
|
||||
UNUSED(vars);
|
||||
invalidate_termsize(true); // force fish to update its idea of the terminal size plus vars
|
||||
}
|
||||
|
||||
static void handle_fish_history_change(env_stack_t &vars) {
|
||||
static void handle_fish_history_change(const env_stack_t &vars) {
|
||||
reader_change_history(history_session_id(vars));
|
||||
}
|
||||
|
||||
static void handle_function_path_change(env_stack_t &vars) {
|
||||
static void handle_function_path_change(const env_stack_t &vars) {
|
||||
UNUSED(vars);
|
||||
function_invalidate_path();
|
||||
}
|
||||
|
||||
static void handle_complete_path_change(env_stack_t &vars) {
|
||||
static void handle_complete_path_change(const env_stack_t &vars) {
|
||||
UNUSED(vars);
|
||||
complete_invalidate_path();
|
||||
}
|
||||
|
||||
static void handle_tz_change(const wcstring &var_name, env_stack_t &vars) {
|
||||
static void handle_tz_change(const wcstring &var_name, const env_stack_t &vars) {
|
||||
handle_timezone(var_name.c_str(), vars);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ fd_monitor_t::fd_monitor_t() {
|
|||
// Add an item for ourselves.
|
||||
// We don't need to go through 'pending' because we have not yet launched the thread, and don't
|
||||
// want to yet.
|
||||
auto callback = [this](autoclose_fd_t &fd, bool timed_out) {
|
||||
auto callback = [this](const autoclose_fd_t &fd, bool timed_out) {
|
||||
ASSERT_IS_BACKGROUND_THREAD();
|
||||
assert(!timed_out && "Should not time out with kNoTimeout");
|
||||
(void)timed_out;
|
||||
|
|
|
@ -582,9 +582,9 @@ bool input_mapping_set_t::erase(const wcstring &sequence, const wcstring &mode,
|
|||
}
|
||||
|
||||
bool input_mapping_set_t::get(const wcstring &sequence, const wcstring &mode,
|
||||
wcstring_list_t *out_cmds, bool user, wcstring *out_sets_mode) {
|
||||
wcstring_list_t *out_cmds, bool user, wcstring *out_sets_mode) const {
|
||||
bool result = false;
|
||||
mapping_list_t &ml = user ? mapping_list_ : preset_mapping_list_;
|
||||
const auto &ml = user ? mapping_list_ : preset_mapping_list_;
|
||||
for (const input_mapping_t &m : ml) {
|
||||
if (sequence == m.seq && mode == m.mode) {
|
||||
*out_cmds = m.commands;
|
||||
|
|
|
@ -100,7 +100,7 @@ class input_mapping_set_t {
|
|||
/// Gets the command bound to the specified key sequence in the specified mode. Returns true if
|
||||
/// it exists, false if not.
|
||||
bool get(const wcstring &sequence, const wcstring &mode, wcstring_list_t *out_cmds, bool user,
|
||||
wcstring *out_sets_mode);
|
||||
wcstring *out_sets_mode) const;
|
||||
|
||||
/// Returns all mapping names and modes.
|
||||
std::vector<input_mapping_name_t> get_names(bool user = true) const;
|
||||
|
|
|
@ -178,7 +178,7 @@ class input_event_queue_t {
|
|||
std::deque<char_event_t> queue_;
|
||||
|
||||
/// \return if we have any lookahead.
|
||||
bool has_lookahead() { return !queue_.empty(); }
|
||||
bool has_lookahead() const { return !queue_.empty(); }
|
||||
|
||||
/// \return the next event in the queue.
|
||||
char_event_t pop();
|
||||
|
|
|
@ -120,7 +120,7 @@ struct thread_pool_t {
|
|||
static void *run_trampoline(void *vpool);
|
||||
|
||||
/// Attempt to spawn a new pthread.
|
||||
bool spawn();
|
||||
bool spawn() const;
|
||||
|
||||
/// No copying or moving.
|
||||
thread_pool_t(const thread_pool_t &) = delete;
|
||||
|
@ -229,8 +229,8 @@ void *thread_pool_t::run_trampoline(void *pool) {
|
|||
}
|
||||
|
||||
/// Spawn another thread. No lock is held when this is called.
|
||||
bool thread_pool_t::spawn() {
|
||||
return make_detached_pthread(&run_trampoline, static_cast<void *>(this));
|
||||
bool thread_pool_t::spawn() const {
|
||||
return make_detached_pthread(&run_trampoline, const_cast<thread_pool_t *>(this));
|
||||
}
|
||||
|
||||
int thread_pool_t::perform(void_function_t &&func, void_function_t &&completion, bool cant_wait) {
|
||||
|
|
|
@ -406,7 +406,7 @@ class parse_ll_t {
|
|||
void parse_error(parse_token_t token, parse_error_code_t code, const wchar_t *fmt, ...);
|
||||
void parse_error_at_location(size_t source_start, size_t source_length, size_t error_location,
|
||||
parse_error_code_t code, const wchar_t *fmt, ...);
|
||||
void parse_error_failed_production(struct parse_stack_element_t &elem, parse_token_t token);
|
||||
void parse_error_failed_production(const struct parse_stack_element_t &elem, parse_token_t token);
|
||||
void parse_error_unbalancing_token(parse_token_t token);
|
||||
|
||||
// Reports an error for an unclosed block, e.g. 'begin;'. Returns true on success, false on
|
||||
|
@ -701,7 +701,7 @@ void parse_ll_t::parse_error_unbalancing_token(parse_token_t token) {
|
|||
}
|
||||
|
||||
/// This is a 'generic' parse error when we can't match the top of the stack element.
|
||||
void parse_ll_t::parse_error_failed_production(struct parse_stack_element_t &stack_elem,
|
||||
void parse_ll_t::parse_error_failed_production(const struct parse_stack_element_t &stack_elem,
|
||||
parse_token_t token) {
|
||||
fatal_errored = true;
|
||||
if (this->should_generate_error_messages) {
|
||||
|
@ -806,7 +806,7 @@ bool parse_ll_t::report_error_for_unclosed_block() {
|
|||
bool parse_ll_t::top_node_handle_terminal_types(const parse_token_t &token) {
|
||||
PARSE_ASSERT(!symbol_stack.empty()); //!OCLINT(multiple unary operator)
|
||||
PARSE_ASSERT(token.type >= FIRST_PARSE_TOKEN_TYPE);
|
||||
parse_stack_element_t &stack_top = symbol_stack.back();
|
||||
const auto &stack_top = symbol_stack.back();
|
||||
|
||||
if (!type_is_terminal_type(stack_top.type)) {
|
||||
return false; // was not handled
|
||||
|
|
|
@ -87,7 +87,7 @@ class editable_line_t {
|
|||
|
||||
bool empty() const { return text().empty(); }
|
||||
|
||||
wchar_t at(size_t idx) { return text().at(idx); }
|
||||
wchar_t at(size_t idx) const { return text().at(idx); }
|
||||
|
||||
void clear() {
|
||||
undo_history.clear();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
static const wcstring VAR_fish_trace = L"fish_trace";
|
||||
|
||||
bool trace_enabled(const parser_t &parser) {
|
||||
auto &ld = parser.libdata();
|
||||
const auto &ld = parser.libdata();
|
||||
if (ld.suppress_fish_trace) return false;
|
||||
// TODO: this variable lookup is somewhat expensive, consider how to make this cheaper.
|
||||
return !parser.vars().get(VAR_fish_trace).missing_or_empty();
|
||||
|
|
Loading…
Reference in a new issue