@@ -125,7 +125,7 @@ compile(#{module := Module, line := Line} = Map) ->
125
125
{Types , Callbacks , TypeSpecs } = typespecs_form (Map , TranslatedTypespecs , Macros ),
126
126
127
127
DocsChunk = docs_chunk (Set , Module , Line , Def , Defmacro , Types , Callbacks ),
128
- CheckerChunk = checker_chunk (Map ),
128
+ CheckerChunk = checker_chunk (Def , Defmacro , Map ),
129
129
load_form (Map , Prefix , Forms , TypeSpecs , DocsChunk ++ CheckerChunk ).
130
130
131
131
dynamic_form (#{module := Module , line := Line , relative_file := RelativeFile ,
@@ -158,7 +158,7 @@ split_definition([{Tuple, Kind, Meta, Clauses} | T], Unreachable, Line,
158
158
split_definition (T , Unreachable , Line , Def , Defmacro , Macros , Exports , Functions )
159
159
end ;
160
160
split_definition ([], _Unreachable , _Line , Def , Defmacro , Macros , Exports , {Head , Tail }) ->
161
- {Def , Defmacro , Macros , Exports , Head ++ Tail }.
161
+ {lists : usort ( Def ), lists : usort ( Defmacro ) , Macros , Exports , Head ++ Tail }.
162
162
163
163
split_definition (Tuple , def , Meta , Clauses , T , Unreachable , Line ,
164
164
Def , Defmacro , Macros , Exports , Functions ) ->
@@ -247,13 +247,11 @@ is_macro(_) -> false.
247
247
248
248
functions_form (Line , Module , Def , Defmacro , Exports , Body , Deprecated , Struct ) ->
249
249
{Spec , Info } = add_info_function (Line , Module , Def , Defmacro , Deprecated , Struct ),
250
- [{attribute , Line , export , lists :sort ([{'__info__' , 1 } | Exports ])}, Spec , Info | Body ].
250
+ [{attribute , Line , export , lists :usort ([{'__info__' , 1 } | Exports ])}, Spec , Info | Body ].
251
251
252
252
add_info_function (Line , Module , Def , Defmacro , Deprecated , Struct ) ->
253
253
AllowedAttrs = [attributes , compile , functions , macros , md5 , exports_md5 , module , deprecated , struct ],
254
254
AllowedArgs = lists :map (fun (Atom ) -> {atom , Line , Atom } end , AllowedAttrs ),
255
- SortedDef = lists :sort (Def ),
256
- SortedDefmacro = lists :sort (Defmacro ),
257
255
258
256
Spec =
259
257
{attribute , Line , spec , {{'__info__' , 1 },
@@ -268,10 +266,10 @@ add_info_function(Line, Module, Def, Defmacro, Deprecated, Struct) ->
268
266
Info =
269
267
{function , 0 , '__info__' , 1 , [
270
268
get_module_info (Module ),
271
- functions_info (SortedDef ),
272
- macros_info (SortedDefmacro ),
269
+ functions_info (Def ),
270
+ macros_info (Defmacro ),
273
271
struct_info (Struct ),
274
- exports_md5_info (Struct , SortedDef , SortedDefmacro ),
272
+ exports_md5_info (Struct , Def , Defmacro ),
275
273
get_module_info (Module , attributes ),
276
274
get_module_info (Module , compile ),
277
275
get_module_info (Module , md5 ),
@@ -418,7 +416,7 @@ callspecs_form(Kind, Entries, Optional, Macros, Forms, ModuleMap) ->
418
416
false ->
419
417
[{attribute , Line , Kind , {Key , lists :reverse (Value )}} | Acc ]
420
418
end
421
- end , Forms , lists :sort (Signatures )).
419
+ end , Forms , lists :usort (Signatures )).
422
420
423
421
spec_for_macro ({type , Line , 'bounded_fun' , [H | T ]}) ->
424
422
{type , Line , 'bounded_fun' , [spec_for_macro (H ) | T ]};
@@ -567,28 +565,23 @@ signature_to_binary(_, Name, Signature) ->
567
565
Doc = 'Elixir.Inspect.Algebra' :format ('Elixir.Code' :quoted_to_algebra (Quoted ), infinity ),
568
566
'Elixir.IO' :iodata_to_binary (Doc ).
569
567
570
- checker_chunk (#{ definitions : = Definitions , deprecated := Deprecated , defines_behaviour := DefinesBehaviour }) ->
568
+ checker_chunk (Def , Defmacro , #{ deprecated := Deprecated , defines_behaviour := DefinesBehaviour }) ->
571
569
DeprecatedMap = maps :from_list (Deprecated ),
572
570
573
571
Exports =
574
- lists :foldl (fun ({Function , Kind , _Meta , _Clauses }, Acc ) ->
575
- case Kind of
576
- _ when Kind == def orelse Kind == defmacro ->
577
- Reason = maps :get (Function , DeprecatedMap , nil ),
578
- [{Function , #{kind => Kind , deprecated_reason => Reason }} | Acc ];
579
- _ ->
580
- Acc
581
- end
582
- end , [], Definitions ),
572
+ [{FA , #{kind => def , deprecated_reason => maps :get (FA , DeprecatedMap , nil )}}
573
+ || FA <- prepend_behaviour_info (DefinesBehaviour , Def )] ++
574
+ [{FA , #{kind => defmacro , deprecated_reason => maps :get (FA , DeprecatedMap , nil )}}
575
+ || FA <- Defmacro ],
583
576
584
577
Contents = #{
585
- exports => lists : sort ( behaviour_info_exports ( DefinesBehaviour ) ++ Exports )
578
+ exports => Exports
586
579
},
587
580
588
581
[{<<" ExCk" >>, term_to_binary ({elixir_checker_v1 , Contents }, [deterministic ])}].
589
582
590
- behaviour_info_exports (true ) -> [{{ behaviour_info , 1 }, #{ kind => def , deprecated_reason => nil }} ];
591
- behaviour_info_exports (false ) -> [] .
583
+ prepend_behaviour_info (true , Def ) -> [{behaviour_info , 1 } | Def ];
584
+ prepend_behaviour_info (false , Def ) -> Def .
592
585
593
586
% % Errors
594
587
0 commit comments