@@ -62,16 +62,40 @@ defmodule ExDoc.Language.Erlang do
62
62
def function_data ( entry , module_data ) do
63
63
{ { kind , name , arity } , _anno , _signature , doc_content , metadata } = entry
64
64
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
69
66
function_data ( name , arity , doc_content , module_data , metadata )
70
67
else
71
68
:skip
72
69
end
73
70
end
74
71
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
+
75
99
defp equiv_data ( module , file , line , metadata , prefix \\ "" ) do
76
100
case metadata [ :equiv ] do
77
101
nil ->
@@ -102,33 +126,6 @@ defmodule ExDoc.Language.Erlang do
102
126
end
103
127
end
104
128
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
-
132
129
@ impl true
133
130
def callback_data ( entry , module_data ) do
134
131
{ { _kind , name , arity } , anno , signature , _doc , metadata } = entry
0 commit comments