File 2315-beam_dict-Add-missing-types-and-specs.patch of Package erlang

From cccda0664fa8ba98e718838a0b9d0bc857ea8948 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 15 Dec 2016 09:20:47 +0100
Subject: [PATCH 15/21] beam_dict: Add missing types and specs

---
 lib/compiler/src/beam_dict.erl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/compiler/src/beam_dict.erl b/lib/compiler/src/beam_dict.erl
index 98e0506ba..719d799fd 100644
--- a/lib/compiler/src/beam_dict.erl
+++ b/lib/compiler/src/beam_dict.erl
@@ -28,7 +28,7 @@
 	 string_table/1,lambda_table/1,literal_table/1,
 	 line_table/1]).
 
--type label() :: non_neg_integer().
+-type label() :: beam_asm:label().
 
 -type index() :: non_neg_integer().
 
@@ -38,13 +38,16 @@
 -type line_tab()   :: #{{Fname :: index(), Line :: term()} => index()}.
 -type literal_tab() :: dict:dict(Literal :: term(), index()).
 
+-type lambda_info() :: {label(),{index(),label(),non_neg_integer()}}.
+-type lambda_tab() :: {non_neg_integer(),[lambda_info()]}.
+
 -record(asm,
 	{atoms = #{}                :: atom_tab(),
 	 exports = []		    :: [{label(), arity(), label()}],
 	 locals = []		    :: [{label(), arity(), label()}],
 	 imports = gb_trees:empty() :: import_tab(),
 	 strings = <<>>		    :: binary(),	%String pool
-	 lambdas = {0,[]},				%[{...}]
+	 lambdas = {0,[]}           :: lambda_tab(),
 	 literals = dict:new()	    :: literal_tab(),
 	 fnames = #{}               :: fname_tab(),
 	 lines = #{}                :: line_tab(),
@@ -182,6 +185,9 @@ line([{location,Name,Line}], #asm{lines=Lines,num_lines=N}=Dict0) ->
             {Index, Dict1#asm{lines=Lines#{Key=>Index},num_lines=N+1}}
     end.
 
+-spec fname(nonempty_string(), bdict()) ->
+                   {non_neg_integer(), bdict()}.
+
 fname(Name, #asm{fnames=Fnames}=Dict) ->
     case Fnames of
         #{Name := Index} -> {Index,Dict};
-- 
2.11.0

openSUSE Build Service is sponsored by