Remove the index parameter from parser_t::is_function

It was always 0 in practice.
This commit is contained in:
ridiculousfish 2021-07-15 11:04:06 -07:00
parent 8bed818039
commit bad1b84513
2 changed files with 3 additions and 4 deletions

View file

@ -416,9 +416,8 @@ wcstring parser_t::stack_trace() const {
/// NULL otherwise. This is tested by moving down the block-scope-stack, checking every block if it /// NULL otherwise. This is tested by moving down the block-scope-stack, checking every block if it
/// is of type FUNCTION_CALL. If the caller doesn't specify a starting position in the stack we /// is of type FUNCTION_CALL. If the caller doesn't specify a starting position in the stack we
/// begin with the current block. /// begin with the current block.
const wchar_t *parser_t::is_function(size_t idx) const { const wchar_t *parser_t::is_function() const {
for (size_t block_idx = idx; block_idx < block_list.size(); block_idx++) { for (const auto &b : block_list) {
const block_t &b = block_list[block_idx];
if (b.is_function_call()) { if (b.is_function_call()) {
return b.function_name.c_str(); return b.function_name.c_str();
} else if (b.type() == block_type_t::source) { } else if (b.type() == block_type_t::source) {

View file

@ -285,7 +285,7 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
/// Returns the name of the currently evaluated function if we are currently evaluating a /// Returns the name of the currently evaluated function if we are currently evaluating a
/// function, null otherwise. This is tested by moving down the block-scope-stack, checking /// function, null otherwise. This is tested by moving down the block-scope-stack, checking
/// every block if it is of type FUNCTION_CALL. /// every block if it is of type FUNCTION_CALL.
const wchar_t *is_function(size_t idx = 0) const; const wchar_t *is_function() const;
/// Create a parser. /// Create a parser.
parser_t(); parser_t();