4
4
-module (elixir_dispatch ).
5
5
-export ([dispatch_import /5 , dispatch_require /6 ,
6
6
require_function /5 , import_function /4 ,
7
- expand_import /5 , expand_require /5 ,
7
+ expand_import /6 , expand_require /5 ,
8
8
default_functions /0 , default_macros /0 , default_requires /0 ,
9
9
find_import /4 , format_error /1 ]).
10
10
-include (" elixir.hrl" ).
@@ -88,7 +88,7 @@ remote_function(Meta, Receiver, Name, Arity, E) ->
88
88
89
89
dispatch_import (Meta , Name , Args , E , Callback ) ->
90
90
Arity = length (Args ),
91
- case expand_import (Meta , {Name , Arity }, Args , E , []) of
91
+ case expand_import (Meta , {Name , Arity }, Args , E , [], false ) of
92
92
{ok , Receiver , Quoted } ->
93
93
expand_quoted (Meta , Receiver , Name , Arity , Quoted , E );
94
94
{ok , Receiver , NewName , NewArgs } ->
@@ -115,12 +115,12 @@ dispatch_require(_Meta, Receiver, Name, Args, _E, Callback) ->
115
115
116
116
% % Macros expansion
117
117
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 ),
124
124
125
125
case Dispatch of
126
126
% % In case it is an import, we dispatch the import.
0 commit comments