Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
tidier
  • Loading branch information
freke committed Jun 3, 2012
1 parent 7eee83b commit 0b049d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/protobuffs_compile.erl
Expand Up @@ -205,7 +205,7 @@ parse_imports([{import, File} = Head | Tail], Path, Acc) ->
ok = file:close(F),
{ok,String} = parse_file(Fullname),
{ok,FirstParsed} = parse_string(String),
Parsed = lists:append(FirstParsed, Tail),
Parsed = FirstParsed ++ Tail,
parse_imports(Parsed, Path, [Head | Acc]);
{error, Error} ->
error_logger:error_report(["Could not do import",
Expand Down
15 changes: 4 additions & 11 deletions src/protobuffs_compile_lib.erl
Expand Up @@ -517,7 +517,7 @@ replace_atom(Other, _Find, _Replace) ->
set_line_number(L,{N,_}) ->
{N,L};
set_line_number(L,{N,_,R}) when is_list(R) ->
List = lists:map(fun(Element) -> set_line_number(L,Element) end, R),
List = [set_line_number(L, Element) || Element <- R],
{N,L,List};
set_line_number(L,{N,_,R}) when is_tuple(R) ->
Tuple = set_line_number(L,R),
Expand Down Expand Up @@ -613,8 +613,7 @@ collect_full_messages([{extend, Name, ExtendedFields} | Tail], Collected) ->
(Id,From,To) -> From =< Id andalso Id =< To
end,

ExtendedFieldsOut = lists:append(FieldsOut,
lists:foldl(
ExtendedFieldsOut = FieldsOut ++ lists:foldl(
fun ({Id, _, _, FieldName, _} = Input,
TmpAcc) ->
case lists:any(
Expand All @@ -637,8 +636,7 @@ collect_full_messages([{extend, Name, ExtendedFields} | Tail], Collected) ->
throw(out_of_range)
end;
(_, TmpAcc) -> TmpAcc
end, [], ExtendedFields)
),
end, [], ExtendedFields),
NewExtends = ExtendFields ++ ExtendedFieldsOut,
NewCollected = Collected#collected{msg=lists:keyreplace(ListName,1,CollectedMsg,{ListName,FieldsOut,NewExtends})},
collect_full_messages(Tail, NewCollected);
Expand All @@ -663,12 +661,7 @@ is_enum_type(Type, [TypePath|Paths], Enums) ->
is_enum_type(Type, Paths, Enums)
end.
is_enum_type(Type, Enums) ->
case lists:keysearch(Type,2,Enums) of
false ->
false;
{value,_} ->
true
end.
lists:keymember(Type, 2, Enums).

resolve_types (Data, Enums) ->
resolve_types (Data, Data, Enums, []).
Expand Down

0 comments on commit 0b049d3

Please sign in to comment.