1818# the name of the function, which is used to ensure that the deprecation warning
1919# is only printed the first time for each call place.
2020
21- macro deprecate (old,new,ex= true )
21+ macro deprecate (old, new, ex= true )
2222 meta = Expr (:meta , :noinline )
2323 @gensym oldmtname
24- if isa (old,Symbol)
25- oldname = Expr (:quote ,old)
26- newname = Expr (:quote ,new)
24+ if isa (old, Symbol)
25+ oldname = Expr (:quote , old)
26+ newname = Expr (:quote , new)
2727 Expr (:toplevel ,
28- ex ? Expr (:export ,esc (old)) : nothing ,
28+ ex ? Expr (:export , esc (old)) : nothing ,
2929 :(function $ (esc (old))(args... )
3030 $ meta
31- depwarn (string ($ oldname," is deprecated, use " ,$ newname," instead." ),
31+ depwarn (string ($ oldname, " is deprecated, use " , $ newname, " instead." ),
3232 $ oldmtname)
3333 $ (esc (new))(args... )
3434 end ),
3535 :(const $ oldmtname = Core. Typeof ($ (esc (old))). name. mt. name))
36- elseif isa (old,Expr) && (old. head == :call || old. head == :where )
36+ elseif isa (old, Expr) && (old. head == :call || old. head == :where )
3737 remove_linenums! (new)
3838 oldcall = sprint (show_unquoted, old)
3939 newcall = sprint (show_unquoted, new)
4040 if old. head == :call
41- if isa (old. args[1 ],Symbol)
41+ if isa (old. args[1 ], Symbol)
4242 oldsym = old. args[1 ]:: Symbol
43- elseif isa (old. args[1 ],Expr) && old. args[1 ]. head == :curly
43+ elseif isa (old. args[1 ], Expr) && old. args[1 ]. head == :curly
4444 oldsym = old. args[1 ]. args[1 ]:: Symbol
4545 else
4646 error (" invalid usage of @deprecate" )
@@ -51,10 +51,10 @@ macro deprecate(old,new,ex=true)
5151 error (" invalid usage of @deprecate" )
5252 end
5353 Expr (:toplevel ,
54- ex ? Expr (:export ,esc (oldsym)) : nothing ,
54+ ex ? Expr (:export , esc (oldsym)) : nothing ,
5555 :($ (esc (old)) = begin
5656 $ meta
57- depwarn (string ($ oldcall," is deprecated, use " ,$ newcall," instead." ),
57+ depwarn (string ($ oldcall, " is deprecated, use " , $ newcall, " instead." ),
5858 $ oldmtname)
5959 $ (esc (new))
6060 end ),
0 commit comments