Skip to content

Commit 2ad1007

Browse files
authored
Test multi-line signatures (#33)
1 parent 640717b commit 2ad1007

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/CodeTracking.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,12 @@ function definition(::Type{String}, method::Method)
204204
end
205205
# The function declaration was presumably on a previous line
206206
lineindex = lastindex(linestarts)
207-
local istart_noerr
208207
while !isfuncexpr(ex) && lineindex > 0
209208
istart = linestarts[lineindex]
210209
try
211210
ex, iend = Meta.parse(src, istart)
212211
catch
213-
istart = istart_noerr
214-
break
215212
end
216-
istart_noerr = istart
217213
lineindex -= 1
218214
line -= 1
219215
end

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ isdefined(Main, :Revise) ? includet("script.jl") : include("script.jl")
3939
@test startswith(src, "@noinline")
4040
@test line == 7
4141

42+
m = first(methods(multilinesig))
43+
src, line = definition(String, m)
44+
@test startswith(src, "@inline")
45+
@test line == 16
46+
4247
info = CodeTracking.PkgFiles(Base.PkgId(CodeTracking))
4348
@test Base.PkgId(info) === info.id
4449
@test CodeTracking.basedir(info) == dirname(@__DIR__)

test/script.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ end
1212
call_throws() = inlined()
1313

1414
f2(x, y) = x + y
15+
16+
@inline function multilinesig(x::Int,
17+
y::String)
18+
z = x + 1
19+
return z
20+
end

0 commit comments

Comments
 (0)