mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
Revert "merge revision(s) c8d162c889
: [Backport #19973]"
This reverts commit 24dd529750
.
This commit is contained in:
parent
24dd529750
commit
1b9ff146e3
3 changed files with 5 additions and 13 deletions
10
parse.y
10
parse.y
|
@ -12889,17 +12889,15 @@ remove_duplicate_keys(struct parser_params *p, NODE *hash)
|
|||
NODE *result = 0;
|
||||
NODE *last_expr = 0;
|
||||
rb_code_location_t loc = hash->nd_loc;
|
||||
while (hash && hash->nd_next) {
|
||||
while (hash && hash->nd_head && hash->nd_next) {
|
||||
NODE *head = hash->nd_head;
|
||||
NODE *value = hash->nd_next;
|
||||
NODE *next = value->nd_next;
|
||||
st_data_t key = (st_data_t)head;
|
||||
st_data_t data;
|
||||
value->nd_next = 0;
|
||||
if (!head) {
|
||||
}
|
||||
else if (nd_type_p(head, NODE_LIT) &&
|
||||
st_delete(literal_keys, (key = (st_data_t)head->nd_lit, &key), &data)) {
|
||||
if (nd_type_p(head, NODE_LIT) &&
|
||||
st_delete(literal_keys, (key = (st_data_t)head->nd_lit, &key), &data)) {
|
||||
NODE *dup_value = ((NODE *)data)->nd_next;
|
||||
rb_compile_warn(p->ruby_sourcefile, nd_line((NODE *)data),
|
||||
"key %+"PRIsVALUE" is duplicated and overwritten on line %d",
|
||||
|
@ -12912,7 +12910,7 @@ remove_duplicate_keys(struct parser_params *p, NODE *hash)
|
|||
}
|
||||
}
|
||||
st_insert(literal_keys, (st_data_t)key, (st_data_t)hash);
|
||||
last_expr = !head || nd_type_p(head, NODE_LIT) ? value : head;
|
||||
last_expr = nd_type_p(head, NODE_LIT) ? value : head;
|
||||
hash = next;
|
||||
}
|
||||
st_foreach(literal_keys, append_literal_keys, (st_data_t)&result);
|
||||
|
|
|
@ -336,12 +336,6 @@ class TestSyntax < Test::Unit::TestCase
|
|||
assert_warn(/duplicated/) {r = eval("a.f(**{k: a.add(1), j: a.add(2), k: a.add(3), k: a.add(4)})")}
|
||||
assert_equal(4, r)
|
||||
assert_equal([1, 2, 3, 4], a)
|
||||
a.clear
|
||||
r = nil
|
||||
z = {}
|
||||
assert_warn(/duplicated/) {r = eval("a.f(k: a.add(1), **z, k: a.add(2))")}
|
||||
assert_equal(2, r)
|
||||
assert_equal([1, 2], a)
|
||||
end
|
||||
|
||||
def test_keyword_empty_splat
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 3
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 159
|
||||
#define RUBY_PATCHLEVEL 158
|
||||
|
||||
#include "ruby/version.h"
|
||||
#include "ruby/internal/abi.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue