From 6c4a5e13ed0430d04adc559229f31b7404242dbc Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sat, 6 Apr 2019 10:57:34 +0200 Subject: [PATCH] fix no arg macros in function defs --- src/utils.jl | 2 +- test/runtests.jl | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index 02052a1..428f75d 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -1,6 +1,6 @@ function isfuncexpr(ex) # Strip any macros that wrap the method definition - while isexpr(ex, :macrocall) + while isexpr(ex, :macrocall) && length(ex.args) == 3 ex = ex.args[3] end isa(ex, Expr) || return false diff --git a/test/runtests.jl b/test/runtests.jl index 204b089..d309de8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -127,4 +127,18 @@ l = @__LINE__ def, line = definition(String, @which d_34(1, 2)) @test line == l - 3 @test def == "(d_34)(x::T, y::T) where {T<:Number} = x === y" +end + +function g() + Base.@_inline_meta + print("hello") +end +@testset "inline macros" begin + def, line = CodeTracking.definition(String, @which g()) + @test def == """ + function g() + Base.@_inline_meta + print("hello") + end + """ end \ No newline at end of file