aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diameter/src/compiler')
-rw-r--r--lib/diameter/src/compiler/diameter_codegen.erl10
-rw-r--r--lib/diameter/src/compiler/diameter_make.erl3
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl
index e606e61052..325a37e20d 100644
--- a/lib/diameter/src/compiler/diameter_codegen.erl
+++ b/lib/diameter/src/compiler/diameter_codegen.erl
@@ -53,12 +53,11 @@
when File :: string(),
ParseD :: orddict:orddict(),
Opts :: list(),
- Mode :: dict | erl | hrl.
+ Mode :: dict | forms | erl | hrl.
from_dict(File, ParseD, Opts, Mode) ->
Outdir = proplists:get_value(outdir, Opts, "."),
putr(verbose, lists:member(verbose, Opts)),
- putr(debug, lists:member(debug, Opts)),
codegen(File, ParseD, Outdir, Mode).
%% Optional reports when running verbosely.
@@ -115,10 +114,11 @@ gen(dict, ParseD, _Mod, Path) ->
gen(hrl, ParseD, Mod, Path) ->
write(Path ++ ".hrl", gen_hrl(Mod, ParseD));
+gen(forms, ParseD, Mod, Path) ->
+ write_term(Path ++ ".F", [erl_forms(Mod, ParseD)]);
+
gen(erl, ParseD, Mod, Path) ->
- Forms = erl_forms(Mod, ParseD),
- getr(debug) andalso write_term(Path ++ ".F", [Forms]),
- write(Path ++ ".erl", [header(), prettypr(Forms), $\n]).
+ write(Path ++ ".erl", [header(), prettypr(erl_forms(Mod, ParseD)), $\n]).
write(Path, T) ->
write(Path, "~s", T).
diff --git a/lib/diameter/src/compiler/diameter_make.erl b/lib/diameter/src/compiler/diameter_make.erl
index f77273d3a5..e4486973dd 100644
--- a/lib/diameter/src/compiler/diameter_make.erl
+++ b/lib/diameter/src/compiler/diameter_make.erl
@@ -61,7 +61,8 @@ codec(File, Opts) ->
make(File,
Opts,
Dict,
- [dict || lists:member(debug, Opts)] ++ [erl, hrl]);
+ lists:append([[dict, forms] || lists:member(debug, Opts)])
+ ++ [erl, hrl]);
{error, _} = E ->
E
end.