more readable syntax error construction
This commit is contained in:
parent
0e735ce7a8
commit
7a6f9df82f
@ -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};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user