File 0001-Fix-rebar-xref-for-recent-Erlang.patch of Package erlang-rebar
From 1b80dcbeee8fd9ac7117b02b7893249ad2b242d1 Mon Sep 17 00:00:00 2001
From: "Matwey V. Kornilov" <matwey.kornilov@gmail.com>
Date: Wed, 12 Oct 2022 19:40:26 +0300
Subject: [PATCH] Fix rebar xref for recent Erlang
(cherry picked from commit 21c06fdf9b67b7bed0e5dd9c86905407abced6aa)
---
src/rebar_xref.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl
index ddfb029..ed905b6 100644
--- a/src/rebar_xref.erl
+++ b/src/rebar_xref.erl
@@ -288,7 +288,7 @@ find_function_source(M, F, A, Bin) ->
AbstractCode = beam_lib:chunks(Bin, [abstract_code]),
{ok, {M, [{abstract_code, {raw_abstract_v1, Code}}]}} = AbstractCode,
%% Extract the original source filename from the abstract code
- [{attribute, 1, file, {Source, _}} | _] = Code,
+ [{attribute, _, file, {Source, _}} | _] = [Attr || Attr = {attribute, _, file, _} <- Code],
%% Extract the line number for a given function def
Fn = [E || E <- Code,
safe_element(1, E) == function,
--
2.37.3