@ -511,7 +511,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -511,7 +511,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
accept_node!(ctx,kid′)
ifany_kid_changed
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
push!(kids′,kid′)
end
@ -531,7 +531,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -531,7 +531,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
# Wrong span, replace it
this_kid_changed=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",span(kid′))
accept_node!(ctx,ws)
@ -568,7 +568,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -568,7 +568,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
kid′=replace_first_leaf(kid′,ws)
this_kid_changed=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",span(ws_node))
accept_node!(ctx,kid′)
@ -579,7 +579,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -579,7 +579,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
# Insert a standalone space kid and then accept the current node
this_kid_changed=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",0)
push!(kids′,ws)
@ -598,7 +598,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -598,7 +598,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
# removed
this_kid_changed=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",span(kid′))
elseifkind(kid′)===K"NewlineWs"||
@ -620,7 +620,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@@ -620,7 +620,7 @@ function spaces_in_listlike(ctx::Context, node::Node)
@assertexpect_trailing_comma
any_kid_changed=true
ifkids′===kids
kids′=kids[1:closing_leaf_idx-1]
kids′=kids[1:(closing_leaf_idx-1)]
end
replace_bytes!(ctx,",",0)
push!(kids′,comma)
@ -714,7 +714,7 @@ function no_spaces_around_x(ctx::Context, node::Node, is_x::F) where {F}
@@ -714,7 +714,7 @@ function no_spaces_around_x(ctx::Context, node::Node, is_x::F) where {F}
# Ignore it but need to copy kids and re-write bytes
any_changes=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",span(kid))
else
@ -741,7 +741,7 @@ function no_spaces_around_x(ctx::Context, node::Node, is_x::F) where {F}
@@ -741,7 +741,7 @@ function no_spaces_around_x(ctx::Context, node::Node, is_x::F) where {F}
end
ifany_changes
ifkids===kids′
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
push!(kids′,kid)
end
@ -847,7 +847,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
@@ -847,7 +847,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
# Replace with single space.
any_changes=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
replace_bytes!(ctx,"",span(kid))
push!(kids′,ws)
@ -864,7 +864,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
@@ -864,7 +864,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
accept_node!(ctx,kid′)
any_changes=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
push!(kids′,kid′)
end
@ -875,7 +875,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
@@ -875,7 +875,7 @@ function spaces_around_keywords(ctx::Context, node::Node)
@assertkind(node)===K"where"
any_changes=true
ifkids′===kids
kids′=kids[1:i-1]
kids′=kids[1:(i-1)]
end
# Insert the space before/after the kid depending on whether we are looking
# for a space before or after a keyword
@ -1040,8 +1040,8 @@ function braces_around_where_rhs(ctx::Context, node::Node)
@@ -1040,8 +1040,8 @@ function braces_around_where_rhs(ctx::Context, node::Node)