Skip to content

Commit

Permalink
Don't striplines! from macrocalls
Browse files Browse the repository at this point in the history
The Base.show method that processes macrocall expressions assumes the first line number is intact
  • Loading branch information
timholy committed Jul 27, 2018
1 parent 89104d4 commit a88f0e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/relocatable_exprs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ function Base.show(io::IO, rex::RelocatableExpr)
end

function striplines!(rex::RelocatableExpr)
if rex.head == :macrocall
# for macros, the show method in Base assumes the line number is there,
# so don't strip it
args3 = [a isa RelocatableExpr ? striplines!(a) : a for a in rex.args[3:end]]
return RelocatableExpr(rex.head, rex.args[1:2]..., args3...)
end
args = [a isa RelocatableExpr ? striplines!(a) : a for a in rex.args]
fargs = collect(LineSkippingIterator(args))
return RelocatableExpr(rex.head, fargs...)
Expand Down

0 comments on commit a88f0e6

Please sign in to comment.