aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/v3_life.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-12-15 09:14:10 +0100
committerBjörn Gustavsson <[email protected]>2017-01-12 12:10:11 +0100
commit0ace5c171f78f0da492ff036a0d1beac68822883 (patch)
tree3f921b5ef30f69aa9ec2f3a6da72c314218aab56 /lib/compiler/src/v3_life.erl
parent718f11a09b9ba11c04cd2d6d7f69c19bac2b3710 (diff)
downloadotp-0ace5c171f78f0da492ff036a0d1beac68822883.tar.gz
otp-0ace5c171f78f0da492ff036a0d1beac68822883.tar.bz2
otp-0ace5c171f78f0da492ff036a0d1beac68822883.zip
v3_life: Add types and specs
Diffstat (limited to 'lib/compiler/src/v3_life.erl')
-rw-r--r--lib/compiler/src/v3_life.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/compiler/src/v3_life.erl b/lib/compiler/src/v3_life.erl
index 0f2aeda87f..be3ade47ff 100644
--- a/lib/compiler/src/v3_life.erl
+++ b/lib/compiler/src/v3_life.erl
@@ -52,10 +52,15 @@
-include("v3_kernel.hrl").
-include("v3_life.hrl").
+-type fa() :: {atom(),arity()}.
+
%% These are not defined in v3_kernel.hrl.
get_kanno(Kthing) -> element(2, Kthing).
%%set_kanno(Kthing, Anno) -> setelement(2, Kthing, Anno).
+-spec module(#k_mdef{}, [compile:option()]) ->
+ {'ok',{module(),[fa()],[_],[_]}}.
+
module(#k_mdef{name=M,exports=Es,attributes=As,body=Fs0}, _Opts) ->
Fs1 = functions(Fs0, []),
{ok,{M,Es,As,Fs1}}.
@@ -416,6 +421,10 @@ add_var(V, F, L, Vdb) ->
vdb_new(Vs) ->
sort([{V,0,0} || {var,V} <- Vs]).
+-type var() :: atom().
+
+-spec vdb_find(var(), [vdb_entry()]) -> 'error' | vdb_entry().
+
vdb_find(V, Vdb) ->
case lists:keyfind(V, 1, Vdb) of
false -> error;