Skip to content

Commit

Permalink
Getting though bootstrap after fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro3 committed Sep 19, 2015
1 parent 4f569a3 commit 3c78946
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions base/coreimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ include("int.jl")
include("operators.jl")
include("pointer.jl")

# # traits
# traits
getindex(A::Array, i1::Real) = arrayref(A, to_index(i1))
include("traits.jl")
#include("traits-bootstrap-tests.jl")
include("traits-bootstrap-tests.jl")

# core array operations
include("abstractarray.jl")
Expand Down
4 changes: 2 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ eval(m,x) = Core.eval(m,x)

include("exports.jl")

if false
if true
# simple print definitions for debugging. enable these if something
# goes wrong during bootstrap before printing code is available.
show(x::ANY) = ccall(:jl_static_show, Void, (Ptr{Void}, Any),
Expand Down Expand Up @@ -51,7 +51,7 @@ include("functors.jl")

# traits
include("traits.jl")
#include("traits-bootstrap-tests.jl")
include("traits-bootstrap-tests.jl")

# array structures
include("abstractarray.jl")
Expand Down
18 changes: 12 additions & 6 deletions base/traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ macro traitfn(tfn)
tmp1 = :($tmp1())
addtoargs!(tmp1, args)
tmp2 = :($fname($curmod.trait($trait)))
addtoargs!(tmp2, striparg(args))
addtoargs!(tmp2, stripType(striparg(args)))
fwrap = :($tmp1 = ($curmod.@_inline_meta(); $tmp2))

# The function containing the logic
Expand Down Expand Up @@ -252,6 +252,11 @@ striparg{T}(args::Array{T,1}) = [striparg(args[i]) for i=1:arraylen(args)]
striparg(a::Symbol) = a
striparg(a::Expr) = a.args[1]

# :(Type{X}) -> X, X->X
stripType{T}(args::Array{T,1}) = [stripType(args[i]) for i=1:arraylen(args)]
stripType(a::Symbol) = a
stripType(a::Expr) = (a.head==:curly && a.args[1]==:Type) ? a.args[2] : a

####
# Some trait definitions
####
Expand All @@ -273,19 +278,20 @@ typealias IsNothing{X} Not{IsAnything{X}}
end
end

# # from reflection.jl (need to be moved elsewhere because they don't bootstrap here)
# "Trait of all isbits-types"
# @traitdef IsBits{X}
# @generated trait{X}(::Type{IsBits{X}}) =
# @generated function trait{X}(::Type{IsBits{X}})
# isbits(X) ? :(IsBits{X}) : :(Not{IsBits{X}})
# end

# "Trait of all immutable types"
# @traitdef IsImmutable{X}
# @generated trait{X}(::Type{IsImmutable{X}}) =
# @generated function trait{X}(::Type{IsImmutable{X}})
# X.mutable ? :(Not{IsImmutable{X}}) : :(IsImmutable{X})
# end

# "Trait of all leaf types types"
# @traitdef IsLeafType{X}
# @generated trait{X}(::Type{IsLeafType{X}}) =
# @generated function trait{X}(::Type{IsLeafType{X}})
# X.mutable ? :(Not{IsLeafType{X}}) : :(IsLeafType{X})

# end

0 comments on commit 3c78946

Please sign in to comment.