Skip to content

Commit

Permalink
Where syntax in boot.jl file
Browse files Browse the repository at this point in the history
  • Loading branch information
musm committed Apr 19, 2017
1 parent c63e29a commit 10eb7c5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,32 +295,32 @@ Task(f::ANY) = ccall(:jl_new_task, Ref{Task}, (Any, Int), f, 0)
# so the methods and ccall's in Core aren't permitted to use convert
convert(::Type{Any}, x::ANY) = x
convert(::Type{T}, x::T) where {T} = x
cconvert{T}(::Type{T}, x) = convert(T, x)
cconvert(::Type{T}, x) where {T} = convert(T, x)
unsafe_convert(::Type{T}, x::T) where {T} = x

NTuple{N,T} = Tuple{Vararg{T,N}}


# primitive array constructors
(::Type{Array{T,N}}){T,N}(d::NTuple{N,Int}) =
(::Type{Array{T,N}})(d::NTuple{N,Int}) where {T,N} =
ccall(:jl_new_array, Array{T,N}, (Any,Any), Array{T,N}, d)
(::Type{Array{T,1}}){T}(d::NTuple{1,Int}) = Array{T,1}(getfield(d,1))
(::Type{Array{T,2}}){T}(d::NTuple{2,Int}) = Array{T,2}(getfield(d,1), getfield(d,2))
(::Type{Array{T,3}}){T}(d::NTuple{3,Int}) = Array{T,3}(getfield(d,1), getfield(d,2), getfield(d,3))
(::Type{Array{T,N}}){T,N}(d::Vararg{Int, N}) = ccall(:jl_new_array, Array{T,N}, (Any,Any), Array{T,N}, d)
(::Type{Array{T,1}}){T}(m::Int) =
(::Type{Array{T,1}})(d::NTuple{1,Int}) where {T} = Array{T,1}(getfield(d,1))
(::Type{Array{T,2}})(d::NTuple{2,Int}) where {T} = Array{T,2}(getfield(d,1), getfield(d,2))
(::Type{Array{T,3}})(d::NTuple{3,Int}) where {T} = Array{T,3}(getfield(d,1), getfield(d,2), getfield(d,3))
(::Type{Array{T,N}})(d::Vararg{Int, N}) where {T,N} = ccall(:jl_new_array, Array{T,N}, (Any,Any), Array{T,N}, d)
(::Type{Array{T,1}})(m::Int) where {T} =
ccall(:jl_alloc_array_1d, Array{T,1}, (Any,Int), Array{T,1}, m)
(::Type{Array{T,2}}){T}(m::Int, n::Int) =
(::Type{Array{T,2}})(m::Int, n::Int) where {T} =
ccall(:jl_alloc_array_2d, Array{T,2}, (Any,Int,Int), Array{T,2}, m, n)
(::Type{Array{T,3}}){T}(m::Int, n::Int, o::Int) =
(::Type{Array{T,3}})(m::Int, n::Int, o::Int) where {T} =
ccall(:jl_alloc_array_3d, Array{T,3}, (Any,Int,Int,Int), Array{T,3}, m, n, o)

(::Type{Array{T}}){T,N}(d::NTuple{N,Int}) = Array{T,N}(d)
(::Type{Array{T}}){T}(m::Int) = Array{T,1}(m)
(::Type{Array{T}}){T}(m::Int, n::Int) = Array{T,2}(m, n)
(::Type{Array{T}}){T}(m::Int, n::Int, o::Int) = Array{T,3}(m, n, o)
(::Type{Array{T}})(d::NTuple{N,Int}) where {T,N} = Array{T,N}(d)
(::Type{Array{T}})(m::Int) where {T} = Array{T,1}(m)
(::Type{Array{T}})(m::Int, n::Int) where {T} = Array{T,2}(m, n)
(::Type{Array{T}})(m::Int, n::Int, o::Int) where {T} = Array{T,3}(m, n, o)

(::Type{Array{T,1}}){T}() = Array{T,1}(0)
(::Type{Array{T,1}})() where {T} = Array{T,1}(0)

# primitive Symbol constructors
function Symbol(s::String)
Expand Down

0 comments on commit 10eb7c5

Please sign in to comment.