Skip to content

Commit

Permalink
Fixed a bug that caused crashes on modules containing no functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeg committed Mar 8, 2005
1 parent 8b70be4 commit 38d0a00
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/msc/src/internal_exports.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ apply(Module, Function, Args) ->
end.

parse_transform(ParseTree, Options) ->
P1 = add_export(ParseTree, ?EXPORTER, 0),
Fs = functions(P1),
F = exporter_function(Fs),
insert_function(P1, F).
case functions(ParseTree) of
[] ->
%% No functions in this module. Leave it alone.
ParseTree;
Fs ->
P1 = add_export(ParseTree, ?EXPORTER, 0),
F = exporter_function(Fs),
insert_function(P1, F)
end.

%% add_export(ParseTree, Function, Arity) -> ParseTree'
add_export([{attribute, Line, export, Es}|T], Function, Arity) ->
Expand Down

0 comments on commit 38d0a00

Please sign in to comment.