diff --git a/interpreter.cpp b/interpreter.cpp index 632f492..285f515 100644 --- a/interpreter.cpp +++ b/interpreter.cpp @@ -129,7 +129,8 @@ void interpreter::exec_instruction(const std::string& code, bool& done) { else if (code == "err") err(); else { auto it = std::upper_bound(_pc_offsets.begin(), _pc_offsets.end(), _pc); - size_t lineno {it - _pc_offsets.begin() + _pc + 1}; + long num_removed_source_lines {it - _pc_offsets.begin()}; + size_t lineno {num_removed_source_lines + _pc + 1}; throw syntax_error {code, lineno}; } }