Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Params fix #299

Merged
merged 2 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/internals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function parse_parameters(ps::ParseState, args::Vector{EXPR}, args1::Vector{EXPR
push!(trivia, EXPR(:errortoken, EXPR[EXPR(:COMMA, 0, 0)], nothing))
end
if kindof(ps.ws) == SemiColonWS
parse_parameters(ps, args1; usekw=usekw)
parse_parameters(ps, args1, EXPR[], 1; usekw=usekw)
end
prevpos = isfirst ? loop_check(ps, prevpos) : position(ps)
isfirst = true
Expand Down
14 changes: 0 additions & 14 deletions src/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,6 @@ function Expr(x::EXPR)
Expr(:string, Expr.(x.args[2:end])...)
elseif x.args === nothing
Expr(Symbol(lowercase(String(x.head))))
elseif x.head === :parameters
if length(x.args) > 1 && any(a -> a.head === :parameters, x.args)
ordered_args = EXPR[]
for arg in x.args
if arg.head === :parameters
pushfirst!(ordered_args, arg)
else
push!(ordered_args, arg)
end
end
Expr(:parameters, Expr.(ordered_args)...)
else
Expr(:parameters, Expr.(x.args)...)
end
elseif x.head === :errortoken
Expr(:error)
else
Expand Down
10 changes: 9 additions & 1 deletion src/iterate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ function _getindex(x::EXPR, i)
elseif headof(x) === :outer
ta(x, i)
elseif headof(x) === :parameters
if length(x.args) > 1 && headof(x.args[2]) === :parameters
if length(x.args) > 1 && headof(x.args[1]) === :parameters
if i == length(x)
x.args[1]
elseif iseven(i)
x.trivia[div(i, 2)]
else
x.args[div(i + 1, 2) + 1]
end
elseif length(x.args) > 1 && headof(x.args[2]) === :parameters
if i == length(x)
x.args[2]
elseif i == 1
Expand Down