You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/01/05 21:27:01 UTC
[couchdb-rebar] 01/01: Relax xref ANNO limitation
This is an automated email from the ASF dual-hosted git repository.
jaydoane pushed a commit to branch xref-anno
in repository https://gitbox.apache.org/repos/asf/couchdb-rebar.git
commit e70e5b4238f37e144a34b8b724d010d37d2baa93
Author: Jay Doane <ja...@apache.org>
AuthorDate: Thu Jan 5 13:16:10 2023 -0800
Relax xref ANNO limitation
Currently this xref interface assumes an ANNO format of a single line
number, but versions of OTP > 23 return a tuple, resulting in a an
error like:
ERROR: xref failed while processing /Users/jay/repos/couchdb/src/snappy: {'EXIT',
{{badmatch,
[{attribute,{1,1},file,{"src/snappy.erl",1}},
This relaxes the assumption on any particular ANNO format and accepts
them all.
---
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..edc203c 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, _}} | _] = Code,
%% Extract the line number for a given function def
Fn = [E || E <- Code,
safe_element(1, E) == function,