aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler/diameter_codegen.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/diameter/src/compiler/diameter_codegen.erl')
-rw-r--r--lib/diameter/src/compiler/diameter_codegen.erl26
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl
index 47da193457..22422f2ef2 100644
--- a/lib/diameter/src/compiler/diameter_codegen.erl
+++ b/lib/diameter/src/compiler/diameter_codegen.erl
@@ -49,7 +49,7 @@
when File :: string(),
ParseD :: orddict:orddict(),
Opts :: list(),
- Mode :: parse | forms | erl | hrl | beam.
+ Mode :: parse | forms | erl | hrl.
from_dict(File, ParseD, Opts, Mode) ->
Outdir = proplists:get_value(outdir, Opts, "."),
@@ -85,8 +85,6 @@ do_write(M, Path, T)
when M == parse;
M == forms ->
write_term(Path, T);
-do_write(beam, Path, {_Mod, Beam}) ->
- write(Path, Beam);
do_write(_, Path, T) ->
write(Path, T).
@@ -130,10 +128,7 @@ gen(parse, ParseD, _Mod) ->
[?VERSION | ParseD];
gen(forms, ParseD, Mod) ->
- erl_forms(Mod, ParseD);
-
-gen(beam, ParseD, Mod) ->
- compile(pp(erl_forms(Mod, ParseD)));
+ pp(erl_forms(Mod, ParseD));
gen(hrl, ParseD, Mod) ->
gen_hrl(Mod, ParseD);
@@ -141,17 +136,6 @@ gen(hrl, ParseD, Mod) ->
gen(erl, ParseD, Mod) ->
[header(), prettypr(erl_forms(Mod, ParseD)), $\n].
-compile({ok, Forms}) ->
- case compile:forms(Forms, [debug_info, return]) of
- {ok, Mod, Beam, _Warnings} ->
- {Mod, Beam};
- {error, Errors, _Warnings} ->
- erlang:error({compile, Errors})
- end;
-
-compile({error, Reason}) ->
- erlang:error(Reason).
-
erl_forms(Mod, ParseD) ->
Forms = [[{?attribute, module, Mod},
{?attribute, compile, {parse_transform, diameter_exprecs}},
@@ -866,10 +850,10 @@ pp(Forms) ->
pp(Forms, {ok, Code}) ->
Files = files(Code, []),
- {ok, lists:flatmap(fun(T) -> include(T, Files) end, Forms)};
+ lists:flatmap(fun(T) -> include(T, Files) end, Forms);
-pp(_, {error, _} = No) ->
- No.
+pp(Forms, {error, Reason}) ->
+ erlang:error({forms, Reason, Forms}).
include({attribute, _, include_lib, Path}, Files) ->
Inc = filename:basename(Path),