@@ -1210,7 +1210,8 @@ defmodule Module do
1210
1210
if kind in [ :defp , :defmacrop , :typep ] do
1211
1211
if doc , do: { :error , :private_doc } , else: :ok
1212
1212
else
1213
- compile_doc ( data_table_for ( module ) , line , kind , function_tuple , signature , doc , __ENV__ )
1213
+ table = data_table_for ( module )
1214
+ compile_doc ( table , line , kind , function_tuple , signature , doc , __ENV__ , false )
1214
1215
:ok
1215
1216
end
1216
1217
end
@@ -1229,13 +1230,13 @@ defmodule Module do
1229
1230
_since = compile_since ( table )
1230
1231
1231
1232
# TODO: Store @since and @deprecated alongside the docs
1232
- { line , doc } = get_doc_info ( table , env , impl )
1233
- compile_doc ( table , line , kind , pair , args , doc , env )
1233
+ { line , doc } = get_doc_info ( table , env )
1234
+ compile_doc ( table , line , kind , pair , args , doc , env , impl )
1234
1235
1235
1236
:ok
1236
1237
end
1237
1238
1238
- defp compile_doc ( _table , line , kind , { name , arity } , _args , doc , env )
1239
+ defp compile_doc ( _table , line , kind , { name , arity } , _args , doc , env , _impl )
1239
1240
when kind in [ :defp , :defmacrop ] do
1240
1241
if doc do
1241
1242
error_message =
@@ -1246,16 +1247,18 @@ defmodule Module do
1246
1247
end
1247
1248
end
1248
1249
1249
- defp compile_doc ( table , line , kind , pair , args , doc , env ) do
1250
+ defp compile_doc ( table , line , kind , pair , args , doc , env , impl ) do
1250
1251
signature = build_signature ( args , env )
1251
1252
1252
1253
case :ets . lookup ( table , { :doc , pair } ) do
1253
1254
[ ] ->
1255
+ doc = if is_nil ( doc ) && impl , do: false , else: doc
1254
1256
:ets . insert ( table , { { :doc , pair } , line , kind , signature , doc } )
1255
1257
1256
1258
[ { doc_tuple , line , _current_kind , current_sign , current_doc } ] ->
1257
1259
signature = merge_signatures ( current_sign , signature , 1 )
1258
1260
doc = if is_nil ( doc ) , do: current_doc , else: doc
1261
+ doc = if is_nil ( doc ) && impl , do: false , else: doc
1259
1262
:ets . insert ( table , { doc_tuple , line , kind , signature , doc } )
1260
1263
end
1261
1264
end
@@ -1750,16 +1753,13 @@ defmodule Module do
1750
1753
value
1751
1754
end
1752
1755
1753
- defp get_doc_info ( table , env , impl ) do
1756
+ defp get_doc_info ( table , env ) do
1754
1757
case :ets . take ( table , :doc ) do
1755
1758
[ { :doc , { _ , _ } = pair , _ , _ } ] ->
1756
1759
pair
1757
1760
1758
- [ ] when impl == false ->
1759
- { env . line , nil }
1760
-
1761
1761
[ ] ->
1762
- { env . line , false }
1762
+ { env . line , nil }
1763
1763
end
1764
1764
end
1765
1765
0 commit comments