Skip to content

Commit

Permalink
stringify at runtime instead of using try in assert macro
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 11, 2013
1 parent fda6afe commit d3be255
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions base/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ systemerror(p, b::Bool) = b ? throw(SystemError(string(p))) : nothing
assert(x) = assert(x,'?')
assert(x,labl) = x ? nothing : error("assertion failed: ", labl)
macro assert(ex)
strex = try string(ex) catch err ex end # during sysimg build, string(Expr) doesn't work, so we may delay it
:($(esc(ex)) ? nothing : error("assertion failed: ", string($(strex))))
:($(esc(ex)) ? nothing : error("assertion failed: ", string($(Expr(:quote,ex)))))
end

## printing with color ##
Expand Down

0 comments on commit d3be255

Please sign in to comment.