Skip to content

Commit

Permalink
Merge pull request #394 from julia-vscode/sp/fix-public-iterate
Browse files Browse the repository at this point in the history
fix: correctly iterate over :publics
  • Loading branch information
pfitzseb authored Jul 14, 2024
2 parents 5e9255b + 12980ca commit 44f622f
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)
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 44f622f

Please sign in to comment.