Skip to content

Commit

Permalink
Merge pull request #53 from yui-knk/nd_exc_var
Browse files Browse the repository at this point in the history
Use nd_exc_var of RESBODY
  • Loading branch information
yui-knk authored Jul 27, 2024
2 parents 812a4cf + 28ab488 commit e8ae7f4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/ast_to_prism/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def convert_node(node, block: nil)
location(node) # location
)
when :RESBODY
nd_args, nd_body, nd_next = node.children
nd_args, nd_exc_var, nd_body, nd_next = node.children

if nd_args
exceptions = nd_args.children[0...-1].map do |n|
Expand All @@ -1115,15 +1115,14 @@ def convert_node(node, block: nil)
exceptions = []
end

# TODO: Change original node structures and extract ERRINFO info
if errinfo_assign?(nd_body) # `rescue Err => e` or not
reference = convert_errinfo_assignment(nd_body.children[0])
statements = convert_begin_statements(nd_body, 1..-1)
if nd_exc_var # `rescue Err => e` or not
reference = convert_errinfo_assignment(nd_exc_var)
else
reference = nil
statements = convert_begin_statements(nd_body)
end

statements = convert_begin_statements(nd_body)

Prism::RescueNode.new(
source, # source
null_location, # keyword_loc
Expand Down

0 comments on commit e8ae7f4

Please sign in to comment.