diff --git a/src/parser.cpp b/src/parser.cpp index a8e69db35..3b25bb173 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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 /// is of type FUNCTION_CALL. If the caller doesn't specify a starting position in the stack we /// begin with the current block. -const wchar_t *parser_t::is_function(size_t idx) const { - for (size_t block_idx = idx; block_idx < block_list.size(); block_idx++) { - const block_t &b = block_list[block_idx]; +const wchar_t *parser_t::is_function() const { + for (const auto &b : block_list) { if (b.is_function_call()) { return b.function_name.c_str(); } else if (b.type() == block_type_t::source) { diff --git a/src/parser.h b/src/parser.h index f7822e751..19fa21110 100644 --- a/src/parser.h +++ b/src/parser.h @@ -285,7 +285,7 @@ class parser_t : public std::enable_shared_from_this { /// 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 /// 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. parser_t();