Skip to content

Commit d21c477

Browse files
KristofferCtimholy
authored andcommitted
fix no arg macros in function defs (#43)
Fixes #41
1 parent d15af5a commit d21c477

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function isfuncexpr(ex)
22
# Strip any macros that wrap the method definition
3-
while isexpr(ex, :macrocall)
3+
while isexpr(ex, :macrocall) && length(ex.args) == 3
44
ex = ex.args[3]
55
end
66
isa(ex, Expr) || return false

test/runtests.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,16 @@ l = @__LINE__
128128
@test line == l - 3
129129
@test def == "(d_34)(x::T, y::T) where {T<:Number} = x === y"
130130
end
131+
132+
function g()
133+
Base.@_inline_meta
134+
print("hello")
135+
end
136+
@testset "inline macros" begin
137+
def, line = CodeTracking.definition(String, @which g())
138+
@test def == """
139+
function g()
140+
Base.@_inline_meta
141+
print("hello")
142+
end"""
143+
end

0 commit comments

Comments
 (0)