Skip to content

Commit

Permalink
fix: correctly iterate over :publics
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Jul 13, 2024
1 parent 5e9255b commit 12980ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/iterate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function _getindex(x::EXPR, i)
x.args[i]
elseif headof(x) === :export
oddt_evena(x, i)
elseif headof(x) === :public
oddt_evena(x, i)

Check warning on line 47 in src/iterate.jl

View check run for this annotation

Codecov / codecov/patch

src/iterate.jl#L47

Added line #L47 was not covered by tests
elseif headof(x) === :filter
_filter(x, i)
elseif headof(x) === :flatten
Expand Down
15 changes: 15 additions & 0 deletions test/iterate/test_iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,21 @@ end
@test x[6] === x.args[3]
end

if VERSION > v"1.11-"
@testitem ":public" begin
using CSTParser: @cst_str, headof, valof

x = cst"public a, b, c"
@test length(x) == 6
@test x[1] === x.trivia[1]
@test x[2] === x.args[1]
@test x[3] === x.trivia[2]
@test x[4] === x.args[2]
@test x[5] === x.trivia[3]
@test x[6] === x.args[3]
end
end

@testitem ":parameters" begin
using CSTParser: @cst_str, headof, valof

Expand Down

0 comments on commit 12980ca

Please # to comment.