diff --git a/src/iterate.jl b/src/iterate.jl index cb57a9b4..eeec50fa 100644 --- a/src/iterate.jl +++ b/src/iterate.jl @@ -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) elseif headof(x) === :filter _filter(x, i) elseif headof(x) === :flatten diff --git a/test/iterate/test_iterators.jl b/test/iterate/test_iterators.jl index 97aa4678..9de76ede 100644 --- a/test/iterate/test_iterators.jl +++ b/test/iterate/test_iterators.jl @@ -744,6 +744,19 @@ end @test x[6] === x.args[3] end +@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 + @testitem ":parameters" begin using CSTParser: @cst_str, headof, valof