From a88f0e699cec94a28c212fd52c97777e279137d8 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 26 Jul 2018 11:10:51 -0500 Subject: [PATCH] Don't striplines! from macrocalls The Base.show method that processes macrocall expressions assumes the first line number is intact --- src/relocatable_exprs.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/relocatable_exprs.jl b/src/relocatable_exprs.jl index 6ead1c6e..7520394d 100644 --- a/src/relocatable_exprs.jl +++ b/src/relocatable_exprs.jl @@ -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...)