I was wondering the same thing myself.  I could not find anything in Base. 
 Here is something that works, at least in Julia 0.4, based on 
base/reflection.jl:functionloc()
Use it with: `macroloc(:@time)`

function macroloc(expr::Expr)

   @assert expr.head == :macrocall

   f=getfield(current_module(),expr.args[1])

   lsd = f.code::LambdaStaticData

   ln = lsd.line

   if ln <= 0

       error("could not determine location of macro definition")

   end

   (Base.find_source_file(string(lsd.file)), ln)

end


On Tuesday, October 13, 2015 at 1:13:34 AM UTC-7, Mohammed El-Beltagy wrote:
>
>
> If want to look up a method is julia, say I am interested in the 
> implementation of the `sine` function, I just run 
>
> ```julia
> julia> methods(sin)
> # 11 methods for generic function "sin":
> sin(a::Complex{Float16}) at float16.jl:151
> sin(z::Complex{T<:Real}) at complex.jl:548
> sin(x::Float64) at math.jl:137
> sin(x::Float32) at math.jl:138
> sin(a::Float16) at float16.jl:150
> sin(x::BigFloat) at mpfr.jl:610
> sin(x::Real) at math.jl:139
> sin{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}) at sparse/sparsematrix.jl:648
> sin{T<:Number}(::AbstractArray{T<:Number,1}) at operators.jl:380
> sin{T<:Number}(::AbstractArray{T<:Number,2}) at operators.jl:381
> sin{T<:Number}(::AbstractArray{T<:Number,N}) at operators.jl:383
> ```
>
> But it seems that there is no clear way of locating the sources files of 
> macros. Or is there?
>
>

Reply via email to