mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/prism] Fix opening loc for an empty symbol
https://github.com/ruby/prism/commit/241d0169da
This commit is contained in:
parent
a5cee8fa79
commit
49ddbbf39f
@ -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);
|
||||
|
||||
|
||||
@ -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 }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user