@@ -62,16 +62,40 @@ defmodule ExDoc.Language.Erlang do
6262 def function_data ( entry , module_data ) do
6363 { { kind , name , arity } , _anno , _signature , doc_content , metadata } = entry
6464
65- # TODO: Edoc on Erlang/OTP24.1+ includes private functions in
66- # the chunk, so we manually yank them out for now.
67- if kind == :function and doc_content != :hidden and
68- function_exported? ( module_data . module , name , arity ) do
65+ if kind == :function and doc_content != :hidden do
6966 function_data ( name , arity , doc_content , module_data , metadata )
7067 else
7168 :skip
7269 end
7370 end
7471
72+ defp function_data ( name , arity , _doc_content , module_data , metadata ) do
73+ specs =
74+ case Map . fetch ( module_data . private . specs , { name , arity } ) do
75+ { :ok , spec } ->
76+ [ spec ]
77+
78+ :error ->
79+ case Map . fetch ( module_data . private . specs , { module_data . module , name , arity } ) do
80+ { :ok , spec } ->
81+ [ spec ]
82+
83+ :error ->
84+ [ ]
85+ end
86+ end
87+
88+ { file , line } = Source . fetch_function_location! ( module_data , { name , arity } )
89+
90+ % {
91+ doc_fallback: fn -> equiv_data ( module_data . module , file , line , metadata ) end ,
92+ extra_annotations: [ ] ,
93+ source_line: line ,
94+ source_file: file ,
95+ specs: specs
96+ }
97+ end
98+
7599 defp equiv_data ( module , file , line , metadata , prefix \\ "" ) do
76100 case metadata [ :equiv ] do
77101 nil ->
@@ -102,33 +126,6 @@ defmodule ExDoc.Language.Erlang do
102126 end
103127 end
104128
105- defp function_data ( name , arity , _doc_content , module_data , metadata ) do
106- specs =
107- case Map . fetch ( module_data . private . specs , { name , arity } ) do
108- { :ok , spec } ->
109- [ spec ]
110-
111- :error ->
112- case Map . fetch ( module_data . private . specs , { module_data . module , name , arity } ) do
113- { :ok , spec } ->
114- [ spec ]
115-
116- :error ->
117- [ ]
118- end
119- end
120-
121- { file , line } = Source . fetch_function_location! ( module_data , { name , arity } )
122-
123- % {
124- doc_fallback: fn -> equiv_data ( module_data . module , file , line , metadata ) end ,
125- extra_annotations: [ ] ,
126- source_line: line ,
127- source_file: file ,
128- specs: specs
129- }
130- end
131-
132129 @ impl true
133130 def callback_data ( entry , module_data ) do
134131 { { _kind , name , arity } , anno , signature , _doc , metadata } = entry
0 commit comments