diff options
author | Harry Lawrence <hello@hazbo.co.uk> | 2021-12-08 19:49:49 +0000 |
---|---|---|
committer | Harry Lawrence <hello@hazbo.co.uk> | 2021-12-12 18:42:02 +0000 |
commit | 34b0649c744c93e9f143c3c7ec14276a57ff3d06 (patch) | |
tree | c0db475b6b9a544605f3fa4656035fedbc337ce5 /lib/syntax_tools | |
parent | 06a64a1da1d304550400c541177a1840c8d1ced1 (diff) | |
download | erlang-34b0649c744c93e9f143c3c7ec14276a57ff3d06.tar.gz |
Fixes analysing a wild attribute to return Info
As per issue #4671:
erl_syntax_lib:analyze_attribute({attribute,17,mark,mark_1}).
returns {mark, {mark, mark_1}} due to the attribute being wrapped on
line 1320:
{A, analyze_attribute(A, Node)}
when what would be expected as per the documentation is:
{mark, mark1}
Returning *just* the Info from {_, Info} = analyze_wild_attribute(Node)
within analyze_attribute/2, this double wrapping does not occur, fixing
the original issue.
Diffstat (limited to 'lib/syntax_tools')
-rw-r--r-- | lib/syntax_tools/src/erl_syntax_lib.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/syntax_tools/src/erl_syntax_lib.erl b/lib/syntax_tools/src/erl_syntax_lib.erl index 6185007235..6ca224ea8e 100644 --- a/lib/syntax_tools/src/erl_syntax_lib.erl +++ b/lib/syntax_tools/src/erl_syntax_lib.erl @@ -1106,7 +1106,7 @@ collect_attribute(file, _, Info) -> Info; collect_attribute(record, {R, L}, Info) -> finfo_add_record(R, L, Info); -collect_attribute(_, {N, V}, Info) -> +collect_attribute(N, V, Info) -> finfo_add_attribute(N, V, Info). %% Abstract datatype for collecting module information. @@ -1335,7 +1335,8 @@ analyze_attribute(record, Node) -> analyze_record_attribute(Node); analyze_attribute(_, Node) -> %% A "wild" attribute (such as e.g. a `compile' directive). - analyze_wild_attribute(Node). + {_, Info} = analyze_wild_attribute(Node), + Info. %% ===================================================================== |