From 0e45f26863df356d279cba760f407935bcab093d Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Tue, 31 Jan 2012 05:07:10 -0800 Subject: [PATCH] Fix record defaults handling --- src/seresye_engine.erl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/seresye_engine.erl b/src/seresye_engine.erl index 64c13ee..a061c84 100644 --- a/src/seresye_engine.erl +++ b/src/seresye_engine.erl @@ -250,16 +250,16 @@ get_records([_ | Tail], Acc) -> get_record_fields([], Acc) -> lists:reverse(Acc); get_record_fields([{record_field, _, - {atom, _, FieldName}, {atom, _, DefaultValue}} + {atom, _, FieldName}, {Type, _, DefaultValue}} | Tail], Acc) -> - NewAcc = [{FieldName, DefaultValue} | Acc], + NewAcc = [{FieldName, {Type, DefaultValue}} | Acc], get_record_fields(Tail, NewAcc); get_record_fields([{record_field, _, {atom, _, FieldName}} | Tail], Acc) -> - NewAcc = [{FieldName} | Acc], + NewAcc = [{FieldName, {atom, undefined}} | Acc], get_record_fields(Tail, NewAcc). @@ -403,10 +403,8 @@ get_record_def(Name, [_ | Rest]) -> get_record_def(Name, Rest). make_record_default([], Acc) -> lists:reverse(Acc); -make_record_default([{_} | Tail], Acc) -> - make_record_default(Tail, [{var, 0, '_'} | Acc]); -make_record_default([{_, Value} | Tail], Acc) -> - make_record_default(Tail, [{atom, 0, Value} | Acc]). +make_record_default([{_,_} | Tail], Acc) -> + make_record_default(Tail, [{var, 0, '_'} | Acc]). make_record_pattern([], Pattern, _RecordDefinition) -> Pattern;