Skip to content

Commit 12980ca

Browse files
committed
fix: correctly iterate over :publics
1 parent 5e9255b commit 12980ca

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/iterate.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function _getindex(x::EXPR, i)
4343
x.args[i]
4444
elseif headof(x) === :export
4545
oddt_evena(x, i)
46+
elseif headof(x) === :public
47+
oddt_evena(x, i)
4648
elseif headof(x) === :filter
4749
_filter(x, i)
4850
elseif headof(x) === :flatten

test/iterate/test_iterators.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,21 @@ end
744744
@test x[6] === x.args[3]
745745
end
746746

747+
if VERSION > v"1.11-"
748+
@testitem ":public" begin
749+
using CSTParser: @cst_str, headof, valof
750+
751+
x = cst"public a, b, c"
752+
@test length(x) == 6
753+
@test x[1] === x.trivia[1]
754+
@test x[2] === x.args[1]
755+
@test x[3] === x.trivia[2]
756+
@test x[4] === x.args[2]
757+
@test x[5] === x.trivia[3]
758+
@test x[6] === x.args[3]
759+
end
760+
end
761+
747762
@testitem ":parameters" begin
748763
using CSTParser: @cst_str, headof, valof
749764

0 commit comments

Comments
 (0)