mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Move ruby_node_name
to node.c and rename prefix of the function
This commit is contained in:
parent
ef3aa22738
commit
98637d421d
Notes:
git
2023-05-23 09:05:55 +00:00
8 changed files with 27 additions and 27 deletions
19
node.c
19
node.c
|
@ -29,7 +29,7 @@
|
|||
#define A_LIT(lit) AR(rb_dump_literal(lit))
|
||||
#define A_NODE_HEADER(node, term) \
|
||||
rb_str_catf(buf, "@ %s (id: %d, line: %d, location: (%d,%d)-(%d,%d))%s"term, \
|
||||
ruby_node_name(nd_type(node)), nd_node_id(node), nd_line(node), \
|
||||
rb_node_name(nd_type(node)), nd_node_id(node), nd_line(node), \
|
||||
nd_first_lineno(node), nd_first_column(node), \
|
||||
nd_last_lineno(node), nd_last_column(node), \
|
||||
(node->flags & NODE_FL_NEWLINE ? "*" : ""))
|
||||
|
@ -1107,7 +1107,7 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
|
|||
break;
|
||||
}
|
||||
|
||||
rb_bug("dump_node: unknown node: %s", ruby_node_name(nd_type(node)));
|
||||
rb_bug("dump_node: unknown node: %s", rb_node_name(nd_type(node)));
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -1144,6 +1144,17 @@ rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2)
|
|||
n->node_id = -1;
|
||||
}
|
||||
|
||||
const char *
|
||||
rb_node_name(int node)
|
||||
{
|
||||
switch (node) {
|
||||
#include "node_name.inc"
|
||||
default:
|
||||
rb_bug("unknown node: %d", node);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct node_buffer_elem_struct {
|
||||
struct node_buffer_elem_struct *next;
|
||||
long len;
|
||||
|
@ -1284,7 +1295,7 @@ 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));
|
||||
rb_node_name(old_type), rb_node_name(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1379,7 +1390,7 @@ mark_ast_value(void *ctx, NODE * node)
|
|||
rb_gc_mark_movable(node->nd_rval);
|
||||
break;
|
||||
default:
|
||||
rb_bug("unreachable node %s", ruby_node_name(nd_type(node)));
|
||||
rb_bug("unreachable node %s", rb_node_name(nd_type(node)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue