diff options
author | Hans Bolinder <[email protected]> | 2016-02-17 13:01:46 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-02-17 13:01:46 +0100 |
commit | f524d3baff6f63846efa571851cc3cc4a55916bd (patch) | |
tree | fe8a5d13ab678425e40a60117519c6a641a07dfc /lib/stdlib/src/ms_transform.erl | |
parent | 05a24fed7539f861c7d725829acb196a3991923c (diff) | |
parent | 6285f2874977e033d02b3c0b77da78e35e771961 (diff) | |
download | otp-f524d3baff6f63846efa571851cc3cc4a55916bd.tar.gz otp-f524d3baff6f63846efa571851cc3cc4a55916bd.tar.bz2 otp-f524d3baff6f63846efa571851cc3cc4a55916bd.zip |
Merge branch 'hb/stdlib/epp_typed_record_fields/OTP-13148'
* hb/stdlib/epp_typed_record_fields/OTP-13148:
stdlib: Update qlc_pt to handle typed record fields
stdlib: Let the linter detect old typed records
stdlib: Update the linter to handle typed record fields
stdlib: Update erl_expand_records to handle typed record fields
compiler: Update the compiler to handle typed record fields
stdlib: Update erl_id_trans to handle types and specs
stdlib: Add a Cover test with typed record field
stdlib: Update module shell to handle typed record fields
stdlib: Update ms_transform to handle typed record fields
stdlib: Modify the preprocessor as to expose typed record fields
Diffstat (limited to 'lib/stdlib/src/ms_transform.erl')
-rw-r--r-- | lib/stdlib/src/ms_transform.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl index b67b6f75d7..24b5fde1db 100644 --- a/lib/stdlib/src/ms_transform.erl +++ b/lib/stdlib/src/ms_transform.erl @@ -307,15 +307,18 @@ cleanup_filename({Old,OldRec,OldWarnings}) -> add_record_definition({Name,FieldList}) -> {KeyList,_} = lists:foldl( - fun({record_field,_,{atom,Line0,FieldName}},{L,C}) -> - {[{FieldName,C,{atom,Line0,undefined}}|L],C+1}; - ({record_field,_,{atom,_,FieldName},Def},{L,C}) -> - {[{FieldName,C,Def}|L],C+1} - end, + fun(F, {L,C}) -> {[record_field(F, C)|L],C+1} end, {[],2}, FieldList), put_records([{Name,KeyList}|get_records()]). +record_field({record_field,_,{atom,Line0,FieldName}}, C) -> + {FieldName,C,{atom,Line0,undefined}}; +record_field({record_field,_,{atom,_,FieldName},Def}, C) -> + {FieldName,C,Def}; +record_field({typed_record_field,Field,_Type}, C) -> + record_field(Field, C). + forms([F0|Fs0]) -> F1 = form(F0), Fs1 = forms(Fs0), |