@@ -1298,20 +1298,11 @@ defmodule TokenMissingError do
1298
1298
{ lines , total_trimmed_lines } = handle_trailing_newlines ( snippet )
1299
1299
end_line = end_line - total_trimmed_lines
1300
1300
1301
- # For cases such as inside ExUnit doctests, our snippet is tiny, containing
1302
- # only the lines in the doctest, but the `line` and `end_line` we receive
1303
- # are still tied to the whole file.
1304
- #
1305
- # In these situations we use `line_offset` to treat `line` as 1 for
1306
- # operating on the snippet, while retaining the original line information.
1307
- should_use_line_offset? = is_nil ( Enum . at ( lines , end_line - 1 ) )
1308
-
1309
1301
end_column =
1310
- if should_use_line_offset? do
1311
- fetch_line_length ( lines , end_line - line_offset - 1 )
1312
- else
1313
- fetch_line_length ( lines , end_line - 1 )
1314
- end
1302
+ lines
1303
+ |> Enum . fetch! ( end_line - line_offset - 1 )
1304
+ |> String . length ( )
1305
+ |> Kernel . + ( 1 )
1315
1306
1316
1307
start_pos = { line , column }
1317
1308
end_pos = { end_line , end_column }
@@ -1356,13 +1347,6 @@ defmodule TokenMissingError do
1356
1347
{ lines , total_trimmed_newlines }
1357
1348
end
1358
1349
1359
- defp fetch_line_length ( lines , index ) do
1360
- lines
1361
- |> Enum . fetch! ( index )
1362
- |> String . length ( )
1363
- |> Kernel . + ( 1 )
1364
- end
1365
-
1366
1350
defp format_message ( file , line , column , message ) do
1367
1351
location = Exception . format_file_line_column ( Path . relative_to_cwd ( file ) , line , column )
1368
1352
"token missing on " <> location <> "\n " <> message
0 commit comments