aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-11-05 13:26:14 +0100
committerHans Bolinder <[email protected]>2016-05-09 08:27:22 +0200
commit4e1c9526bc682e79422d908da0f2b79f3a9936d5 (patch)
tree11d646c5d2587d61813ae980cab4d526b2cbfd16 /lib
parentee802105708818a7d9a2ea05b400168574268319 (diff)
downloadotp-4e1c9526bc682e79422d908da0f2b79f3a9936d5.tar.gz
otp-4e1c9526bc682e79422d908da0f2b79f3a9936d5.tar.bz2
otp-4e1c9526bc682e79422d908da0f2b79f3a9936d5.zip
syntax_tools: Update igor to handle typed records
Diffstat (limited to 'lib')
-rw-r--r--lib/syntax_tools/src/igor.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl
index 4557678f9d..1d14bd7c3a 100644
--- a/lib/syntax_tools/src/igor.erl
+++ b/lib/syntax_tools/src/igor.erl
@@ -2612,6 +2612,19 @@ get_module_info(Forms) ->
fold_record_fields(Rs) ->
[{N, [fold_record_field(F) || F <- Fs]} || {N, Fs} <- Rs].
+fold_record_field({_Name, {none, _Type}} = None) ->
+ None;
+fold_record_field({Name, {F, Type}}) ->
+ case erl_syntax:is_literal(F) of
+ true ->
+ {Name, {value, erl_syntax:concrete(F)}, Type};
+ false ->
+ %% The default value for the field is not a constant, so we
+ %% represent it by a hash value instead. (We don't want to
+ %% do this in the general case.)
+ {Name, {hash, erlang:phash(F, 16#ffffff)}, Type}
+ end;
+%% The following two clauses handle code before Erlang/OTP 19.0.
fold_record_field({_Name, none} = None) ->
None;
fold_record_field({Name, F}) ->