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 b1f82c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ast_to_prism/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ def convert_block_body(node, range = 0..-1)
convert_stmts(node, range)
end
end

alias :convert_case_statements :convert_block_body
alias :convert_begin_statements :convert_block_body

Expand Down Expand Up @@ -817,7 +816,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 b1f82c8

Please sign in to comment.