summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Prokopiev <[email protected]>2024-02-15 11:46:40 +0100
committergit <[email protected]>2024-02-15 20:28:17 +0000
commit49ddbbf39f2600cc4d1e83d1d46bfc2788f31873 (patch)
tree3176ffa1742fd247788a88323b4b6aebd98906f4
parenta5cee8fa79422a295ce200a92b901c4182995800 (diff)
[ruby/prism] Fix opening loc for an empty symbol
https://github.com/ruby/prism/commit/241d0169da
-rw-r--r--prism/prism.c1
-rw-r--r--test/prism/location_test.rb1
2 files changed, 1 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 6b8473cb99..f0f4519b8c 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -14206,7 +14206,6 @@ parse_strings(pm_parser_t *parser, pm_node_t *current) {
// If we get here, then we have an end of a label immediately
// after a start. In that case we'll create an empty symbol
// node.
- pm_token_t opening = not_provided(parser);
pm_token_t content = parse_strings_empty_content(parser->previous.start);
pm_symbol_node_t *symbol = pm_symbol_node_create(parser, &opening, &content, &parser->previous);
diff --git a/test/prism/location_test.rb b/test/prism/location_test.rb
index c60717059e..f5b2ba6d21 100644
--- a/test/prism/location_test.rb
+++ b/test/prism/location_test.rb
@@ -43,6 +43,7 @@ module Prism
end
def test_AssocNode
+ assert_location(AssocNode, "{ '': 1 }", 2...7) { |node| node.elements.first }
assert_location(AssocNode, "{ foo: :bar }", 2...11) { |node| node.elements.first }
assert_location(AssocNode, "{ :foo => :bar }", 2...14) { |node| node.elements.first }
assert_location(AssocNode, "foo(bar: :baz)", 4...13) { |node| node.arguments.arguments.first.elements.first }