Remove needless usage of maybe_t

builtin_function() never returns `none()`; this must have been leftover from a
previous version of the code.
This commit is contained in:
Mahmoud Al-Qudsi
2022-09-25 14:40:49 -05:00
parent ff00d3ca08
commit 5d64b56127
3 changed files with 5 additions and 9 deletions

View File

@@ -222,7 +222,7 @@ static int validate_function_name(int argc, const wchar_t *const *argv, wcstring
/// Define a function. Calls into `function.cpp` to perform the heavy lifting of defining a
/// function.
maybe_t<int> builtin_function(parser_t &parser, io_streams_t &streams,
int builtin_function(parser_t &parser, io_streams_t &streams,
const wcstring_list_t &c_args, const parsed_source_ref_t &source,
const ast::block_statement_t &func_node) {
assert(source && "Missing source in builtin_function");

View File

@@ -13,7 +13,7 @@ namespace ast {
struct block_statement_t;
}
maybe_t<int> builtin_function(parser_t &parser, io_streams_t &streams,
int builtin_function(parser_t &parser, io_streams_t &streams,
const wcstring_list_t &c_args, const parsed_source_ref_t &source,
const ast::block_statement_t &func_node);
#endif

View File

@@ -393,13 +393,9 @@ end_execution_reason_t parse_execution_context_t::run_function_statement(
null_output_stream_t outs;
string_output_stream_t errs;
io_streams_t streams(outs, errs);
int err_code = 0;
maybe_t<int> err = builtin_function(*parser, streams, arguments, pstree, statement);
if (err) {
err_code = err.value();
parser->libdata().status_count++;
parser->set_last_statuses(statuses_t::just(err_code));
}
int err_code = builtin_function(*parser, streams, arguments, pstree, statement);
parser->libdata().status_count++;
parser->set_last_statuses(statuses_t::just(err_code));
const wcstring &errtext = errs.contents();
if (!errtext.empty()) {