diff options
author | Björn Gustavsson <[email protected]> | 2017-01-13 12:07:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-01-13 12:07:06 +0100 |
commit | fa208870c24b7b3cddf3ac0317371b419d1a08d8 (patch) | |
tree | 9c4290a7d6b6902ce68ad18e1358478b2add67ce /lib/compiler/src/cerl.erl | |
parent | ee3f93aec3f2e8b49e0fa9a84ec4d68b687103c5 (diff) | |
parent | 4efd9935a5618fa6622e33eadb3d6add49ab1089 (diff) | |
download | otp-fa208870c24b7b3cddf3ac0317371b419d1a08d8.tar.gz otp-fa208870c24b7b3cddf3ac0317371b419d1a08d8.tar.bz2 otp-fa208870c24b7b3cddf3ac0317371b419d1a08d8.zip |
Merge pull request #1285 from bjorng/bjorn/compiler/type-specs
Add types and specs for all compiler modules
Diffstat (limited to 'lib/compiler/src/cerl.erl')
-rw-r--r-- | lib/compiler/src/cerl.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl index b1be6ffc6d..6b936a7687 100644 --- a/lib/compiler/src/cerl.erl +++ b/lib/compiler/src/cerl.erl @@ -1584,6 +1584,8 @@ ann_make_list(_, [], Node) -> %% @doc Returns <code>true</code> if <code>Node</code> is an abstract %% map constructor, otherwise <code>false</code>. +-type map_op() :: #c_literal{val::'assoc'} | #c_literal{val::'exact'}. + -spec is_c_map(cerl()) -> boolean(). is_c_map(#c_map{}) -> @@ -1679,8 +1681,16 @@ update_c_map(#c_map{is_pat=true}=Old, M, Es) -> update_c_map(#c_map{is_pat=false}=Old, M, Es) -> ann_c_map(get_ann(Old), M, Es). +-spec map_pair_key(c_map_pair()) -> cerl(). + map_pair_key(#c_map_pair{key=K}) -> K. + +-spec map_pair_val(c_map_pair()) -> cerl(). + map_pair_val(#c_map_pair{val=V}) -> V. + +-spec map_pair_op(c_map_pair()) -> map_op(). + map_pair_op(#c_map_pair{op=Op}) -> Op. -spec c_map_pair(cerl(), cerl()) -> c_map_pair(). @@ -1699,6 +1709,8 @@ c_map_pair_exact(Key,Val) -> ann_c_map_pair(As,Op,K,V) -> #c_map_pair{op=Op, key = K, val=V, anno = As}. +-spec update_c_map_pair(c_map_pair(), map_op(), cerl(), cerl()) -> c_map_pair(). + update_c_map_pair(Old,Op,K,V) -> #c_map_pair{op=Op, key=K, val=V, anno = get_ann(Old)}. |