diff --git a/lib/ast_to_prism/parser.rb b/lib/ast_to_prism/parser.rb index 3e192c9..d9e4f95 100644 --- a/lib/ast_to_prism/parser.rb +++ b/lib/ast_to_prism/parser.rb @@ -1176,25 +1176,25 @@ def convert_node(node, block: nil) ) when :AND nd_1st, nd_2nd = node.children + loc, operator_loc = node.locations - # (source, left, right, operator_loc, location) Prism::AndNode.new( - source, - convert_node(nd_1st), - convert_node(nd_2nd), - null_location, - location(node) + source, # source + convert_node(nd_1st), # left + convert_node(nd_2nd), # right + location(operator_loc), # operator_loc + location(loc), # location ) when :OR nd_1st, nd_2nd = node.children + loc, operator_loc = node.locations - # (source, left, right, operator_loc, location) Prism::OrNode.new( - source, - convert_node(nd_1st), - convert_node(nd_2nd), - null_location, - location(node) + source, # source + convert_node(nd_1st), # left + convert_node(nd_2nd), # right + location(operator_loc), # operator_loc + location(loc), # location ) when :MASGN not_supported(node) diff --git a/spec/basic_spec.rb b/spec/basic_spec.rb index 019a303..4cd1d8a 100644 --- a/spec/basic_spec.rb +++ b/spec/basic_spec.rb @@ -897,28 +897,20 @@ def test_code(code) describe "and" do it "tests" do - pending "operator_loc is not supported" - test_code("1 && 2") end it "tests" do - pending "operator_loc is not supported" - test_code("1 and 2") end end describe "or" do it "tests" do - pending "operator_loc is not supported" - test_code("1 || 2") end it "tests" do - pending "operator_loc is not supported" - test_code("1 or 2") end end