summaryrefslogtreecommitdiff
path: root/ruby_parser.c
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-03-24 08:39:27 +0900
committerYuichiro Kaneko <[email protected]>2024-04-02 08:26:58 +0900
commit799e854897856e431c03a5122252358e2c57aff2 (patch)
tree4918d58d1bdcdb229c2419d381743007b62e1d2d /ruby_parser.c
parent8066e3ea6e9462f510e5d0da887be94b18cce50b (diff)
[Feature #20331] Simplify parser warnings for hash keys duplication and when clause duplication
This commit simplifies warnings for hash keys duplication and when clause duplication, based on the discussion of https://bugs.ruby-lang.org/issues/20331. Warnings are reported only when strings are same to ohters.
Diffstat (limited to 'ruby_parser.c')
-rw-r--r--ruby_parser.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/ruby_parser.c b/ruby_parser.c
index 83539612e8..90ee4504a2 100644
--- a/ruby_parser.c
+++ b/ruby_parser.c
@@ -93,32 +93,6 @@ dvar_defined(ID id, const void *p)
return rb_dvar_defined(id, (const rb_iseq_t *)p);
}
-static bool
-hash_literal_key_p(VALUE k)
-{
- switch (OBJ_BUILTIN_TYPE(k)) {
- case T_NODE:
- return false;
- default:
- return true;
- }
-}
-
-static int
-literal_cmp(VALUE val, VALUE lit)
-{
- if (val == lit) return 0;
- if (!hash_literal_key_p(val) || !hash_literal_key_p(lit)) return -1;
- return rb_iseq_cdhash_cmp(val, lit);
-}
-
-static st_index_t
-literal_hash(VALUE a)
-{
- if (!hash_literal_key_p(a)) return (st_index_t)a;
- return rb_iseq_cdhash_hash(a);
-}
-
static int
is_usascii_enc(void *enc)
{
@@ -611,9 +585,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.local_defined = local_defined,
.dvar_defined = dvar_defined,
- .literal_cmp = literal_cmp,
- .literal_hash = literal_hash,
-
.syntax_error_append = syntax_error_append,
.raise = rb_raise,
.syntax_error_new = syntax_error_new,