diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-06-03 12:32:44 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-06-03 15:11:18 +0900 |
commit | 37eb5e74395f148782f7d67b5218fb2e66b113d7 (patch) | |
tree | f92f0414ab29ff9ff6b6dca6a13b600574d165b0 /compile.c | |
parent | a023db49bfbbbe119638bae6abf8113f0de371de (diff) |
Warn more duplicate literal hash keys
Following non-special_const literals:
* T_BIGNUM
* T_FLOAT (non-flonum)
* T_RATIONAL
* T_COMPLEX
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4548
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1967,8 +1967,8 @@ iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl) return COMPILE_OK; } -static int -cdhash_cmp(VALUE val, VALUE lit) +int +rb_iseq_cdhash_cmp(VALUE val, VALUE lit) { int tval, tlit; @@ -2004,20 +2004,20 @@ cdhash_cmp(VALUE val, VALUE lit) else if (tlit == T_RATIONAL) { const struct RRational *rat1 = RRATIONAL(val); const struct RRational *rat2 = RRATIONAL(lit); - return cdhash_cmp(rat1->num, rat2->num) || cdhash_cmp(rat1->den, rat2->den); + return rb_iseq_cdhash_cmp(rat1->num, rat2->num) || rb_iseq_cdhash_cmp(rat1->den, rat2->den); } else if (tlit == T_COMPLEX) { const struct RComplex *comp1 = RCOMPLEX(val); const struct RComplex *comp2 = RCOMPLEX(lit); - return cdhash_cmp(comp1->real, comp2->real) || cdhash_cmp(comp1->imag, comp2->imag); + return rb_iseq_cdhash_cmp(comp1->real, comp2->real) || rb_iseq_cdhash_cmp(comp1->imag, comp2->imag); } else { UNREACHABLE_RETURN(-1); } } -static st_index_t -cdhash_hash(VALUE a) +st_index_t +rb_iseq_cdhash_hash(VALUE a) { switch (OBJ_BUILTIN_TYPE(a)) { case -1: @@ -2039,8 +2039,8 @@ cdhash_hash(VALUE a) } static const struct st_hash_type cdhash_type = { - cdhash_cmp, - cdhash_hash, + rb_iseq_cdhash_cmp, + rb_iseq_cdhash_hash, }; struct cdhash_set_label_struct { |