Skip to content

Commit 58a637f

Browse files
committed
fix(error context generation): bad context generation could sometimes happen if an invalid node is found and is on more than one line
1 parent c0e2071 commit 58a637f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/arkreactor/Exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ namespace Ark::Diagnostics
195195
show_file_location();
196196
LineColorContextCounts line_color_context_counts;
197197

198-
for (auto i = first_line; i < last_line; ++i)
198+
for (auto i = first_line; i < last_line && i < lines.size(); ++i)
199199
{
200200
if (i >= start_line_skipping_at && i < stop_line_skipping_at)
201201
continue;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
000000000080000000000000
2+
80000000000000000
3+
(
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
At 0 @ 1:1
2+
1 | 000000000080000000000000
3+
| ^~~~~~~~~~~~~~~~~~~~~~~
4+
2 | 80000000000000000
5+
| ^~~~~~~~~~~~~~~~
6+
3 | (
7+
| ^
8+
4 |
9+
invalid syntax, expected node

0 commit comments

Comments
 (0)