44-module (elixir_dispatch ).
55-export ([dispatch_import /5 , dispatch_require /6 ,
66 require_function /5 , import_function /4 ,
7- expand_import /5 , expand_require /5 ,
7+ expand_import /6 , expand_require /5 ,
88 default_functions /0 , default_macros /0 , default_requires /0 ,
99 find_import /4 , format_error /1 ]).
1010-include (" elixir.hrl" ).
@@ -88,7 +88,7 @@ remote_function(Meta, Receiver, Name, Arity, E) ->
8888
8989dispatch_import (Meta , Name , Args , E , Callback ) ->
9090 Arity = length (Args ),
91- case expand_import (Meta , {Name , Arity }, Args , E , []) of
91+ case expand_import (Meta , {Name , Arity }, Args , E , [], false ) of
9292 {ok , Receiver , Quoted } ->
9393 expand_quoted (Meta , Receiver , Name , Arity , Quoted , E );
9494 {ok , Receiver , NewName , NewArgs } ->
@@ -115,12 +115,12 @@ dispatch_require(_Meta, Receiver, Name, Args, _E, Callback) ->
115115
116116% % Macros expansion
117117
118- expand_import (Meta , {Name , Arity } = Tuple , Args , E , Extra ) ->
119- Module = ? m (E , module ),
120- Dispatch = find_dispatch (Meta , Tuple , Extra , E ),
121- Function = ? m (E , function ),
122- Local = ( Function /= nil ) andalso (Function /= Tuple ) andalso
123- elixir_locals :macro_for (Module , Name , Arity ),
118+ expand_import (Meta , {Name , Arity } = Tuple , Args , E , Extra , External ) ->
119+ Module = ? m (E , module ),
120+ Dispatch = find_dispatch (Meta , Tuple , Extra , E ),
121+ Function = ? m (E , function ),
122+ AllowLocals = External orelse (( Function /= nil ) andalso (Function /= Tuple )),
123+ Local = AllowLocals andalso elixir_locals :macro_for (Module , Name , Arity ),
124124
125125 case Dispatch of
126126 % % In case it is an import, we dispatch the import.
0 commit comments