88-module (elixir_dispatch ).
99-export ([dispatch_import /6 , dispatch_require /7 ,
1010 require_function /5 , import_function /4 ,
11- expand_import /6 , expand_require /6 , check_deprecated /6 ,
11+ expand_import /7 , expand_require /6 , check_deprecated /6 ,
1212 default_functions /0 , default_macros /0 , default_requires /0 ,
1313 find_import /4 , find_imports /3 , format_error /1 ]).
1414-include (" elixir.hrl" ).
@@ -29,7 +29,7 @@ default_requires() ->
2929find_import (Meta , Name , Arity , E ) ->
3030 Tuple = {Name , Arity },
3131
32- case find_import_by_name_arity (Meta , Tuple , E ) of
32+ case find_import_by_name_arity (Meta , Tuple , [], E ) of
3333 {function , Receiver } ->
3434 elixir_env :trace ({imported_function , Meta , Receiver , Name , Arity }, E ),
3535 Receiver ;
@@ -56,7 +56,7 @@ find_imports(Meta, Name, E) ->
5656
5757import_function (Meta , Name , Arity , E ) ->
5858 Tuple = {Name , Arity },
59- case find_import_by_name_arity (Meta , Tuple , E ) of
59+ case find_import_by_name_arity (Meta , Tuple , [], E ) of
6060 {function , Receiver } ->
6161 elixir_env :trace ({imported_function , Meta , Receiver , Name , Arity }, E ),
6262 elixir_import :record (Tuple , Receiver , ? key (E , module ), ? key (E , function )),
@@ -115,7 +115,7 @@ dispatch_import(Meta, Name, Args, S, E, Callback) ->
115115 _ -> false
116116 end ,
117117
118- case expand_import (Meta , Name , Arity , E , AllowLocals , true ) of
118+ case expand_import (Meta , Name , Arity , E , [], AllowLocals , true ) of
119119 {macro , Receiver , Expander } ->
120120 check_deprecated (macro , Meta , Receiver , Name , Arity , E ),
121121 Caller = {? line (Meta ), S , E },
@@ -159,10 +159,10 @@ dispatch_require(_Meta, Receiver, Name, _Args, _S, _E, Callback) ->
159159
160160% % Macros expansion
161161
162- expand_import (Meta , Name , Arity , E , AllowLocals , Trace ) ->
162+ expand_import (Meta , Name , Arity , E , Extra , AllowLocals , Trace ) ->
163163 Tuple = {Name , Arity },
164164 Module = ? key (E , module ),
165- Dispatch = find_import_by_name_arity (Meta , Tuple , E ),
165+ Dispatch = find_import_by_name_arity (Meta , Tuple , Extra , E ),
166166
167167 case Dispatch of
168168 {ambiguous , Ambiguous } ->
@@ -303,13 +303,13 @@ find_imports_by_name(Name, [{ImportName, _} | Imports], Acc, Mod, Meta, E) when
303303find_imports_by_name (_Name , _Imports , Acc , _Mod , _Meta , _E ) ->
304304 Acc .
305305
306- find_import_by_name_arity (Meta , {_Name , Arity } = Tuple , E ) ->
306+ find_import_by_name_arity (Meta , {_Name , Arity } = Tuple , Extra , E ) ->
307307 case is_import (Meta , Arity ) of
308308 {import , _ } = Import ->
309309 Import ;
310310 false ->
311311 Funs = ? key (E , functions ),
312- Macs = ? key (E , macros ),
312+ Macs = Extra ++ ? key (E , macros ),
313313 FunMatch = find_import_by_name_arity (Tuple , Funs ),
314314 MacMatch = find_import_by_name_arity (Tuple , Macs ),
315315
0 commit comments