aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2016-06-20 16:53:03 +0200
committerStavros Aronis <[email protected]>2016-06-20 17:54:26 +0200
commit9aabc64783ee1a1fbcd5b80ea03f9ef12807cb92 (patch)
tree5f449eae3f97a1137739fdf9db977483f42d6bec /lib/compiler/src/compile.erl
parent043e53da337ea4fff51b3f40594c194d4791cd1b (diff)
downloadotp-9aabc64783ee1a1fbcd5b80ea03f9ef12807cb92.tar.gz
otp-9aabc64783ee1a1fbcd5b80ea03f9ef12807cb92.tar.bz2
otp-9aabc64783ee1a1fbcd5b80ea03f9ef12807cb92.zip
Fix spec of compile:(noenv_)forms/2
The input for a call to compile:(noenv_)forms/2 can also be a cerl module (useful e.g. to resume with 'from_core' after a 'to_core' compilation). Internal representations used for 'from_asm' and 'from_beam' compilation can also be valid, but have no relevant types defined.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 82ff8a95f3..b716867f2f 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -43,6 +43,10 @@
-type abstract_code() :: [erl_parse:abstract_form()].
+%% Internal representations used for 'from_asm' and 'from_beam' compilation can
+%% also be valid, but have no relevant types defined.
+-type forms() :: abstract_code() | cerl:c_module().
+
-type option() :: atom() | {atom(), term()} | {'d', atom(), term()}.
-type err_info() :: {erl_anno:line() | 'none',
@@ -88,7 +92,7 @@ file(File, Opt) ->
forms(Forms) -> forms(Forms, ?DEFAULT_OPTIONS).
--spec forms(abstract_code(), [option()] | option()) -> comp_ret().
+-spec forms(forms(), [option()] | option()) -> comp_ret().
forms(Forms, Opts) when is_list(Opts) ->
do_compile({forms,Forms}, [binary|Opts++env_default_opts()]);
@@ -116,7 +120,7 @@ noenv_file(File, Opts) when is_list(Opts) ->
noenv_file(File, Opt) ->
noenv_file(File, [Opt|?DEFAULT_OPTIONS]).
--spec noenv_forms(abstract_code(), [option()] | option()) -> comp_ret().
+-spec noenv_forms(forms(), [option()] | option()) -> comp_ret().
noenv_forms(Forms, Opts) when is_list(Opts) ->
do_compile({forms,Forms}, [binary|Opts]);