@@ -97,6 +97,20 @@ dispatch_import(Meta, Name, Args, E, Callback) ->
97
97
Callback ()
98
98
end .
99
99
100
+ dispatch_require (Meta , 'Elixir.System' , stacktrace , [], #{contextual_vars := Vars } = E , Callback ) ->
101
+ case lists :member ('__STACKTRACE__' , Vars ) of
102
+ true ->
103
+ {{'__STACKTRACE__' , [], nil }, E };
104
+ false ->
105
+ Message =
106
+ " System.stacktrace/0 outside of rescue/catch clauses is deprecated. "
107
+ " If you want to support only Elixir v1.7+, you must access __STACKTRACE__ "
108
+ " inside a rescue/catch. If you want to support earlier Elixir versions, "
109
+ " move System.stacktrace/0 inside a rescue/catch" ,
110
+ elixir_errors :erl_warn (? line (Meta ), ? key (E , file ), Message ),
111
+ Callback ('Elixir.System' , stacktrace , [])
112
+ end ;
113
+
100
114
dispatch_require (Meta , Receiver , Name , Args , E , Callback ) when is_atom (Receiver ) ->
101
115
Arity = length (Args ),
102
116
@@ -353,18 +367,6 @@ check_deprecated(_, erlang, _, _, _) ->
353
367
ok ;
354
368
check_deprecated (_ , _ , _ , _ , #{module := 'Elixir.HashDict' }) ->
355
369
ok ;
356
- check_deprecated (Meta , 'Elixir.System' , stacktrace , 0 , #{contextual_vars := Vars } = E ) ->
357
- case lists :member ('__STACKTRACE__' , Vars ) of
358
- true ->
359
- ok ;
360
- false ->
361
- Message =
362
- " System.stacktrace/0 outside of rescue/catch clauses is deprecated. "
363
- " If you want to support only Elixir v1.7+, you must access __STACKTRACE__ "
364
- " inside a rescue/catch. If you want to support earlier Elixir versions, "
365
- " move System.stacktrace/0 inside a rescue/catch" ,
366
- elixir_errors :erl_warn (? line (Meta ), ? key (E , file ), Message )
367
- end ;
368
370
check_deprecated (Meta , Receiver , Name , Arity , E ) ->
369
371
case (? key (E , function ) == nil ) andalso is_ensure_loaded (Receiver ) of
370
372
true ->
0 commit comments