@@ -131,7 +131,8 @@ dispatch_import(Meta, Name, Args, S, E, Callback) ->
131131 case expand_import (Meta , Name , Arity , E , [], AllowLocals , true ) of
132132 {macro , Receiver , Expander } ->
133133 check_deprecated (macro , Meta , Receiver , Name , Arity , E ),
134- expand_quoted (Meta , Receiver , Name , Arity , Expander (Args , S ), S , E );
134+ Caller = {? line (Meta ), S , E },
135+ expand_quoted (Meta , Receiver , Name , Arity , Expander (Args , Caller ), S , E );
135136 {function , Receiver , NewName } ->
136137 elixir_expand :expand ({{'.' , Meta , [Receiver , NewName ]}, Meta , Args }, S , E );
137138 not_found ->
@@ -151,7 +152,8 @@ dispatch_require(Meta, Receiver, Name, Args, S, E, Callback) when is_atom(Receiv
151152 case expand_require (Meta , Receiver , Name , Arity , E , true ) of
152153 {macro , Receiver , Expander } ->
153154 check_deprecated (macro , Meta , Receiver , Name , Arity , E ),
154- expand_quoted (Meta , Receiver , Name , Arity , Expander (Args , S ), S , E );
155+ Caller = {? line (Meta ), S , E },
156+ expand_quoted (Meta , Receiver , Name , Arity , Expander (Args , Caller ), S , E );
155157 error ->
156158 check_deprecated (function , Meta , Receiver , Name , Arity , E ),
157159 elixir_env :trace ({remote_function , Meta , Receiver , Name , Arity }, E ),
@@ -246,26 +248,23 @@ expand_require(Required, Meta, Receiver, Name, Arity, E, Trace) ->
246248% % Expansion helpers
247249
248250expander_macro_fun (Meta , Fun , Receiver , Name , E ) ->
249- fun (Args , S ) -> expand_macro_fun (Meta , Fun , Receiver , Name , Args , S , E ) end .
251+ fun (Args , Caller ) -> expand_macro_fun (Meta , Fun , Receiver , Name , Args , Caller , E ) end .
250252
251253expander_macro_named (Meta , Receiver , Name , Arity , E ) ->
252254 ProperName = elixir_utils :macro_name (Name ),
253255 ProperArity = Arity + 1 ,
254256 Fun = fun Receiver :ProperName /ProperArity ,
255- fun (Args , S ) -> expand_macro_fun (Meta , Fun , Receiver , Name , Args , S , E ) end .
256-
257- expand_macro_fun (Meta , Fun , Receiver , Name , Args , S , E ) ->
258- Line = ? line (Meta ),
259- EArg = {Line , S , E },
257+ fun (Args , Caller ) -> expand_macro_fun (Meta , Fun , Receiver , Name , Args , Caller , E ) end .
260258
259+ expand_macro_fun (Meta , Fun , Receiver , Name , Args , Caller , E ) ->
261260 try
262- apply (Fun , [EArg | Args ])
261+ apply (Fun , [Caller | Args ])
263262 catch
264263 Kind :Reason :Stacktrace ->
265264 Arity = length (Args ),
266265 MFA = {Receiver , elixir_utils :macro_name (Name ), Arity + 1 },
267- Info = [{Receiver , Name , Arity , [{file , " expanding macro" }]}, caller (Line , E )],
268- erlang :raise (Kind , Reason , prune_stacktrace (Stacktrace , MFA , Info , {ok , EArg }))
266+ Info = [{Receiver , Name , Arity , [{file , " expanding macro" }]}, caller (? line ( Meta ) , E )],
267+ erlang :raise (Kind , Reason , prune_stacktrace (Stacktrace , MFA , Info , {ok , Caller }))
269268 end .
270269
271270expand_quoted (Meta , Receiver , Name , Arity , Quoted , S , E ) ->
@@ -342,7 +341,7 @@ is_import(Meta, Arity) ->
342341 end .
343342
344343% %% We've reached the macro wrapper fun, skip it with the rest
345- prune_stacktrace ([{_ , _ , [E | _ ], _ } | _ ], _MFA , Info , {ok , E }) ->
344+ prune_stacktrace ([{_ , _ , [Caller | _ ], _ } | _ ], _MFA , Info , {ok , Caller }) ->
346345 Info ;
347346% % We've reached the invoked macro, skip it
348347prune_stacktrace ([{M , F , A , _ } | _ ], {M , F , A }, Info , _E ) ->
0 commit comments