diff --git a/node.c b/node.c index d5096e95d8..5d00823eb6 100644 --- a/node.c +++ b/node.c @@ -438,3 +438,9 @@ rb_node_set_type(NODE *n, enum node_type t) { return nd_init_type(n, t); } + +enum node_type +rb_node_get_type(const NODE *n) +{ + return (enum node_type)nd_type(n); +} diff --git a/node.h b/node.h index 1e411f211b..dff7613936 100644 --- a/node.h +++ b/node.h @@ -67,6 +67,7 @@ const struct kwtable *rb_reserved_word(const char *, unsigned int); struct parser_params; PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt, ...), 2, 3); VALUE rb_node_set_type(NODE *n, enum node_type t); +enum node_type rb_node_get_type(const NODE *n); RUBY_SYMBOL_EXPORT_END