Skip to content

Commit

Permalink
Clean up Symbol usage (after symbol deprecation).
Browse files Browse the repository at this point in the history
From comments by stevengj in #15995.
  • Loading branch information
hayd committed May 1, 2016
1 parent 6f15d92 commit a9df7e9
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function gen_broadcast_body_iter_tobitarray(nd::Int, narrays::Int, f)
end

function gen_broadcast_function(genbody::Function, nd::Int, narrays::Int, f)
As = [Symbol("A_"*string(i)) for i = 1:narrays]
As = [Symbol("A_",i) for i = 1:narrays]
body = genbody(nd, narrays, f)
@eval let
local _F_
Expand All @@ -179,7 +179,7 @@ function gen_broadcast_function(genbody::Function, nd::Int, narrays::Int, f)
end

function gen_broadcast_function_tobitarray(genbody::Function, nd::Int, narrays::Int, f)
As = [Symbol("A_"*string(i)) for i = 1:narrays]
As = [Symbol("A_",i) for i = 1:narrays]
body = genbody(nd, narrays, f)
@eval let
local _F_
Expand Down
2 changes: 1 addition & 1 deletion base/dates/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end
(-)(y::Period,x::TimeType) = x - y

for op in (:.+, :.-)
op_ = Symbol(string(op)[2:end])
op_ = Symbol(string(op)[2])
@eval begin
# GeneralPeriod, AbstractArray{TimeType}
($op){T<:TimeType}(x::AbstractArray{T}, y::GeneralPeriod) =
Expand Down
4 changes: 2 additions & 2 deletions base/dates/periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ for (op,Ty,Tz) in ((:.*,Real,:P),
(:.%,:P,:P),
(:mod,:P,:P))
sop = string(op)
op_ = sop[1] == '.' ? Symbol(sop[2:end]) : op
op_ = sop[1] == '.' ? Symbol(sop[2]) : op
@eval begin
function ($op){P<:Period}(X::StridedArray{P},y::$Ty)
Z = similar(X, $Tz)
Expand Down Expand Up @@ -234,7 +234,7 @@ GeneralPeriod = Union{Period,CompoundPeriod}
(+){P<:GeneralPeriod}(x::StridedArray{P}) = x

for op in (:.+, :.-)
op_ = Symbol(string(op)[2:end])
op_ = Symbol(string(op)[2])
@eval begin
function ($op){P<:GeneralPeriod}(X::StridedArray{P},y::GeneralPeriod)
Z = similar(X, CompoundPeriod)
Expand Down
6 changes: 3 additions & 3 deletions base/dft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ complexfloat{T<:Real}(x::AbstractArray{T}) = copy!(Array(typeof(complex(float(on
# implementations only need to provide plan_X(x, region)
# for X in (:fft, :bfft, ...):
for f in (:fft, :bfft, :ifft, :fft!, :bfft!, :ifft!, :rfft)
pf = Symbol(string("plan_", f))
pf = Symbol("plan_", f)
@eval begin
$f(x::AbstractArray) = $pf(x) * x
$f(x::AbstractArray, region) = $pf(x, region) * x
Expand Down Expand Up @@ -179,7 +179,7 @@ bfft!
# promote to a complex floating-point type (out-of-place only),
# so implementations only need Complex{Float} methods
for f in (:fft, :bfft, :ifft)
pf = Symbol(string("plan_", f))
pf = Symbol("plan_", f)
@eval begin
$f{T<:Real}(x::AbstractArray{T}, region=1:ndims(x)) = $f(complexfloat(x), region)
$pf{T<:Real}(x::AbstractArray{T}, region; kws...) = $pf(complexfloat(x), region; kws...)
Expand Down Expand Up @@ -264,7 +264,7 @@ A_mul_B!(y::AbstractArray, p::ScaledPlan, x::AbstractArray) =
# or odd).

for f in (:brfft, :irfft)
pf = Symbol(string("plan_", f))
pf = Symbol("plan_", f)
@eval begin
$f(x::AbstractArray, d::Integer) = $pf(x, d) * x
$f(x::AbstractArray, d::Integer, region) = $pf(x, d, region) * x
Expand Down
2 changes: 1 addition & 1 deletion base/fft/dct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function plan_inv{T,K,inplace}(p::DCTPlan{T,K,inplace})
end

for f in (:dct, :dct!, :idct, :idct!)
pf = Symbol(string("plan_", f))
pf = Symbol("plan_", f)
@eval begin
$f{T<:fftwNumber}(x::AbstractArray{T}) = $pf(x) * x
$f{T<:fftwNumber}(x::AbstractArray{T}, region) = $pf(x, region) * x
Expand Down
4 changes: 2 additions & 2 deletions base/libuv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function uv_sizeof_req(req)
end

for h in uv_handle_types
@eval const $(Symbol("_sizeof_"*lowercase(string(h)))) = uv_sizeof_handle($h)
@eval const $(Symbol("_sizeof_",lowercase(string(h)))) = uv_sizeof_handle($h)
end
for r in uv_req_types
@eval const $(Symbol("_sizeof_"*lowercase(string(r)))) = uv_sizeof_req($r)
@eval const $(Symbol("_sizeof_",lowercase(string(r)))) = uv_sizeof_req($r)
end

uv_handle_data(handle) = ccall(:jl_uv_handle_data,Ptr{Void},(Ptr{Void},),handle)
Expand Down
4 changes: 2 additions & 2 deletions base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,14 @@ end
for T in indexes.parameters
T <: CartesianIndex ? (M += length(T)) : (M += 1)
end
index_length_expr = index <: Colon ? Symbol(string("Istride_", N+1)) : :(length(index))
index_length_expr = index <: Colon ? Symbol("Istride_", N+1) : :(length(index))
quote
Cartesian.@nexprs $N d->(I_d = indexes[d])
dimlengths = Cartesian.@ncall $N index_lengths_dim V.parent length(V.indexes)-N+1 I
Istride_1 = 1 # strides of the indexes to merge
Cartesian.@nexprs $N d->(Istride_{d+1} = Istride_d*dimlengths[d])
idx_len = $(index_length_expr)
if idx_len < 0.1*$(Symbol(string("Istride_", N+1))) # this has not been carefully tuned
if idx_len < 0.1*$(Symbol("Istride_", N+1)) # this has not been carefully tuned
return merge_indexes_div(V, indexes, index, dimlengths)
end
Cartesian.@nexprs $N d->(counter_d = 1) # counter_0 is the linear index
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ end
for isunittri in (true, false), islowertri in (true, false)
unitstr = isunittri ? "Unit" : ""
halfstr = islowertri ? "Lower" : "Upper"
tritype = :(Base.LinAlg.$(Symbol(string(unitstr, halfstr, "Triangular"))))
tritype = :(Base.LinAlg.$(Symbol(unitstr, halfstr, "Triangular")))

# build out-of-place left-division operations
for (istrans, func, ipfunc) in (
Expand Down
2 changes: 1 addition & 1 deletion base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ _fd(x::IOStream) = RawFD(fd(x))
ccall(:jl_uv_handle,Ptr{Void},(Ptr{Void},),x.handle))

for (x,writable,unix_fd,c_symbol) in ((:STDIN,false,0,:jl_uv_stdin),(:STDOUT,true,1,:jl_uv_stdout),(:STDERR,true,2,:jl_uv_stderr))
f = Symbol("redirect_"*lowercase(string(x)))
f = Symbol("redirect_",lowercase(string(x)))
_f = Symbol("_",f)
@eval begin
function ($_f)(stream)
Expand Down
2 changes: 1 addition & 1 deletion base/threadcall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ macro threadcall(f, rettype, argtypes, argvals...)
body = wrapper.args[2].args
args = Symbol[]
for (i,T) in enumerate(argtypes)
arg = Symbol("arg$i")
arg = Symbol("arg", i)
push!(body, :($arg = unsafe_load(convert(Ptr{$T}, p))))
push!(body, :(p += sizeof($T)))
push!(args, arg)
Expand Down
4 changes: 2 additions & 2 deletions test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ s1 = Struct1(352.39422f23, 19.287577)

for (t,v) in ((Complex{Int32},:ci32),(Complex{Int64},:ci64),
(Complex64,:cf32),(Complex128,:cf64),(Struct1,:s1))
fname = Symbol("foo"*string(v))
fname1 = Symbol("foo1"*string(v))
fname = Symbol("foo",v)
fname1 = Symbol("foo1",v)
@eval begin
verbose && println($t)
a = copy($v)
Expand Down
2 changes: 1 addition & 1 deletion test/fft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ true_fftd3_m3d[:,:,2] = -15
# use invoke to force usage of CTPlan versions even if FFTW is present
for A in (Array,SubArray)
for f in (:fft,:ifft,:plan_fft,:plan_ifft)
f_ = Symbol(string(f, "_"))
f_ = Symbol(f, "_")
@eval begin
$f_{T,N}(x::$A{T,N}) = invoke($f, Tuple{AbstractArray{T,N}}, x)
$f_{T,N,R}(x::$A{T,N},r::R) = invoke($f,Tuple{AbstractArray{T,N},R},x,r)
Expand Down

0 comments on commit a9df7e9

Please sign in to comment.