From 4e1c9526bc682e79422d908da0f2b79f3a9936d5 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Thu, 5 Nov 2015 13:26:14 +0100 Subject: syntax_tools: Update igor to handle typed records --- lib/syntax_tools/src/igor.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/syntax_tools') 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}) -> -- cgit v1.2.3