25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Support Erlang 25 in "make options": returns attribute with simpler syntax

This was introduced in Erlang/OTP 25.0-rc1
https://erlang.org/download/otp_src_25.0-rc1.readme
https://github.com/erlang/otp/pull/5509

  OTP-17894    Application(s): syntax_tools
               Related Id(s): PR-5509

               The erl_syntax_lib:analyze_attribute/1 function would
               return {Name, {Name, Value}} instead of {Name, Value}
               (which is the documented return value).
This commit is contained in:
Badlop 2022-02-22 17:00:17 +01:00
parent d4f288d3c6
commit 231dfd776f

View File

@ -524,6 +524,8 @@ fold_opt(File, Fun, Acc, AbsCode) ->
Fun(File, {#state.defaults, Form}, Acc1);
{attribute, {spec, {spec, {{options, 0}, Spec}}}} ->
Fun(File, {#state.specs, hd(Spec)}, Acc1);
{attribute, {spec, {{options, 0}, Spec}}} ->
Fun(File, {#state.specs, hd(Spec)}, Acc1);
_ ->
Acc1
end
@ -539,6 +541,8 @@ fold_mod_opt(File, Fun, Acc, AbsCode) ->
Fun(File, {#state.mod_defaults, Form}, Acc1);
{attribute, {spec, {spec, {{mod_options, 1}, Spec}}}} ->
Fun(File, {#state.mod_specs, hd(Spec)}, Acc1);
{attribute, {spec, {{mod_options, 1}, Spec}}} ->
Fun(File, {#state.mod_specs, hd(Spec)}, Acc1);
_ ->
Acc1
end
@ -572,6 +576,8 @@ is_behaviour(AbsCode, Mod) ->
{attribute, {Attr, {_, Mod}}}
when Attr == behaviour orelse Attr == behavior ->
true;
{attribute, {behaviour, Mod}} ->
true;
_ ->
false
end