Skip to content
Browse files

Merge pull request #9 from spawngrid/fix-record-defaults

Fix record defaults handling
  • Loading branch information...
2 parents 75d333b + 0e45f26 commit af019caeb23da446616ba2a443153346e47e012c @ericbmerritt ericbmerritt committed Jan 31, 2012
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/seresye_engine.erl
View
12 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;

0 comments on commit af019ca

Please sign in to comment.
Something went wrong with that request. Please try again.