diff options
author | Hans Bolinder <[email protected]> | 2015-11-27 14:14:07 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-02-17 12:58:19 +0100 |
commit | 173b217a37fbb7439857a833d25ea0703e97ea2b (patch) | |
tree | 32247369e60192d752de1463e18945923c350bf5 /lib/stdlib/src/ms_transform.erl | |
parent | de9012628a6b0e97d2f1325bf2f72817f69f84ee (diff) | |
download | otp-173b217a37fbb7439857a833d25ea0703e97ea2b.tar.gz otp-173b217a37fbb7439857a833d25ea0703e97ea2b.tar.bz2 otp-173b217a37fbb7439857a833d25ea0703e97ea2b.zip |
stdlib: Update ms_transform to handle 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), |