Remove duplicate function nd_st_key_val
This commit is contained in:
parent
d6741572ef
commit
7cc8d58cc9
30
parse.y
30
parse.y
@ -14985,34 +14985,6 @@ nd_st_key(struct parser_params *p, NODE *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
nd_st_key_val(struct parser_params *p, NODE *node)
|
|
||||||
{
|
|
||||||
switch (nd_type(node)) {
|
|
||||||
case NODE_LIT:
|
|
||||||
return RNODE_LIT(node)->nd_lit;
|
|
||||||
case NODE_STR:
|
|
||||||
return RNODE_STR(node)->nd_lit;
|
|
||||||
case NODE_INTEGER:
|
|
||||||
return rb_node_integer_literal_val(node);
|
|
||||||
case NODE_FLOAT:
|
|
||||||
return rb_node_float_literal_val(node);
|
|
||||||
case NODE_RATIONAL:
|
|
||||||
return rb_node_rational_literal_val(node);
|
|
||||||
case NODE_IMAGINARY:
|
|
||||||
return rb_node_imaginary_literal_val(node);
|
|
||||||
case NODE_SYM:
|
|
||||||
return rb_node_sym_string_val(node);
|
|
||||||
case NODE_LINE:
|
|
||||||
return rb_node_line_lineno_val(node);
|
|
||||||
case NODE_FILE:
|
|
||||||
return rb_node_file_path_val(node);
|
|
||||||
default:
|
|
||||||
rb_bug("unexpected node: %s", ruby_node_name(nd_type(node)));
|
|
||||||
UNREACHABLE_RETURN(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
warn_duplicate_keys(struct parser_params *p, NODE *hash)
|
warn_duplicate_keys(struct parser_params *p, NODE *hash)
|
||||||
{
|
{
|
||||||
@ -15035,7 +15007,7 @@ warn_duplicate_keys(struct parser_params *p, NODE *hash)
|
|||||||
st_delete(literal_keys, (key = (st_data_t)nd_st_key(p, head), &key), &data)) {
|
st_delete(literal_keys, (key = (st_data_t)nd_st_key(p, head), &key), &data)) {
|
||||||
rb_compile_warn(p->ruby_sourcefile, nd_line((NODE *)data),
|
rb_compile_warn(p->ruby_sourcefile, nd_line((NODE *)data),
|
||||||
"key %+"PRIsVALUE" is duplicated and overwritten on line %d",
|
"key %+"PRIsVALUE" is duplicated and overwritten on line %d",
|
||||||
nd_st_key_val(p, head), nd_line(head));
|
nd_st_key(p, head), nd_line(head));
|
||||||
}
|
}
|
||||||
st_insert(literal_keys, (st_data_t)key, (st_data_t)hash);
|
st_insert(literal_keys, (st_data_t)key, (st_data_t)hash);
|
||||||
hash = next;
|
hash = next;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user