Remove needless check

`nodetype_markable_p` always returns `false` then
`rb_ast_node_type_change` never calls `rb_bug`.
This commit is contained in:
yui-knk 2024-04-04 23:53:47 +09:00 committed by Yuichiro Kaneko
parent fc8fe78c07
commit cebbe18eed
2 changed files with 0 additions and 25 deletions

22
node.c
View File

@ -283,25 +283,6 @@ rb_ast_newnode(rb_ast_t *ast, enum node_type type, size_t size, size_t alignment
return ast_newnode_in_bucket(ast, bucket, size, alignment); return ast_newnode_in_bucket(ast, bucket, size, alignment);
} }
#if RUBY_DEBUG
RBIMPL_ATTR_PURE()
static bool
nodetype_markable_p(enum node_type type)
{
return false;
}
void
rb_ast_node_type_change(NODE *n, enum node_type type)
{
enum node_type old_type = nd_type(n);
if (nodetype_markable_p(old_type) != nodetype_markable_p(type)) {
rb_bug("node type changed: %s -> %s",
ruby_node_name(old_type), ruby_node_name(type));
}
}
#endif
rb_ast_id_table_t * rb_ast_id_table_t *
rb_ast_new_local_table(rb_ast_t *ast, int size) rb_ast_new_local_table(rb_ast_t *ast, int size)
{ {
@ -421,8 +402,5 @@ rb_ast_dispose(rb_ast_t *ast)
VALUE VALUE
rb_node_set_type(NODE *n, enum node_type t) rb_node_set_type(NODE *n, enum node_type t)
{ {
#if RUBY_DEBUG
rb_ast_node_type_change(n, t);
#endif
return nd_init_type(n, t); return nd_init_type(n, t);
} }

3
node.h
View File

@ -53,9 +53,6 @@ rb_ast_t *rb_ast_new(void);
#endif #endif
size_t rb_ast_memsize(const rb_ast_t*); size_t rb_ast_memsize(const rb_ast_t*);
void rb_ast_dispose(rb_ast_t*); void rb_ast_dispose(rb_ast_t*);
#if RUBY_DEBUG
void rb_ast_node_type_change(NODE *n, enum node_type type);
#endif
const char *ruby_node_name(int node); const char *ruby_node_name(int node);
void rb_node_init(NODE *n, enum node_type type); void rb_node_init(NODE *n, enum node_type type);