Skip to content

Commit

Permalink
Implement RetryNode
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Jul 7, 2024
1 parent e6075b6 commit 836059f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ast_to_prism/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,10 @@ def convert_node(node, block: nil)
location(node) # location
)
when :RETRY
not_supported(node)
Prism::RetryNode.new(
source, # source
location(node) # location
)
when :BEGIN
# example: begin; 1; end

Expand Down
13 changes: 13 additions & 0 deletions spec/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,19 @@ def m
end
end

describe "retry" do
it "tests" do
pending "BeginNode locations are not supported"

test_code(<<~CODE)
begin
rescue
retry
end
CODE
end
end

describe "begin, rescue, else, ensure" do
# begin
it "tests" do
Expand Down

0 comments on commit 836059f

Please sign in to comment.