aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_listing.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-12-15 09:22:28 +0100
committerBjörn Gustavsson <[email protected]>2017-01-12 12:10:12 +0100
commitcd2734811a5fe7c891db1063484489a81c6a92b0 (patch)
tree012edde2ca563578627f74487827342c4aba102d /lib/compiler/src/beam_listing.erl
parent96c27f2e656402a9d064766a190edc83f7f5f464 (diff)
downloadotp-cd2734811a5fe7c891db1063484489a81c6a92b0.tar.gz
otp-cd2734811a5fe7c891db1063484489a81c6a92b0.tar.bz2
otp-cd2734811a5fe7c891db1063484489a81c6a92b0.zip
beam_listing: Add types and specs
Diffstat (limited to 'lib/compiler/src/beam_listing.erl')
-rw-r--r--lib/compiler/src/beam_listing.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_listing.erl b/lib/compiler/src/beam_listing.erl
index d82ed8639d..94b47cf568 100644
--- a/lib/compiler/src/beam_listing.erl
+++ b/lib/compiler/src/beam_listing.erl
@@ -21,14 +21,24 @@
-export([module/2]).
+-include("core_parse.hrl").
+-include("v3_kernel.hrl").
-include("v3_life.hrl").
-import(lists, [foreach/2]).
-module(File, Core) when element(1, Core) == c_module ->
+-type code() :: cerl:c_module()
+ | beam_utils:module_code()
+ | #k_mdef{}
+ | {module(),_,_,_} %v3_life
+ | [_]. %form-based format
+
+-spec module(file:io_device(), code()) -> 'ok'.
+
+module(File, #c_module{}=Core) ->
%% This is a core module.
io:put_chars(File, core_pp:format(Core));
-module(File, Kern) when element(1, Kern) == k_mdef ->
+module(File, #k_mdef{}=Kern) ->
%% This is a kernel module.
io:put_chars(File, v3_kernel_pp:format(Kern));
%%io:put_chars(File, io_lib:format("~p~n", [Kern]));