Skip to content
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
Fix right assignment token management
  • Loading branch information
kddnewton committed Aug 23, 2022
commit 87d928c1b5dd440d71b1fdb9576ec382100d793e
7 changes: 6 additions & 1 deletion lib/syntax_tree/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,12 @@ def on_case(value, consequent)
location: keyword.location.to(consequent.location)
)
else
operator = find_token(Kw, "in", consume: false) || find_token(Op, "=>")
operator =
if (keyword = find_token(Kw, "in", consume: false))
tokens.delete(keyword)
else
find_token(Op, "=>")
end

RAssign.new(
value: value,
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/rassign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
ConstantConstantConstant,
ConstantConstantConstant
]
%
a in Integer
b => [Integer => c]