mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Introduce NODE_FILE
`__FILE__` was managed by `NODE_STR` with `String` object. This commit introduces `NODE_FILE` and `struct rb_parser_string` so that 1. `__FILE__` is detectable from AST Node 2. Reduce dependency ruby object
This commit is contained in:
parent
91a0d1c437
commit
7a050638b1
12 changed files with 185 additions and 37 deletions
|
@ -4,12 +4,6 @@
|
|||
|
||||
#include "rubyparser.h"
|
||||
|
||||
VALUE
|
||||
rb_node_line_lineno_val(const NODE *node)
|
||||
{
|
||||
return INT2FIX(node->nd_loc.beg_pos.lineno);
|
||||
}
|
||||
|
||||
#ifdef UNIVERSAL_PARSER
|
||||
|
||||
#include "internal.h"
|
||||
|
@ -920,3 +914,16 @@ rb_parser_set_yydebug(VALUE vparser, VALUE flag)
|
|||
return flag;
|
||||
}
|
||||
#endif
|
||||
|
||||
VALUE
|
||||
rb_node_line_lineno_val(const NODE *node)
|
||||
{
|
||||
return INT2FIX(node->nd_loc.beg_pos.lineno);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_node_file_path_val(const NODE *node)
|
||||
{
|
||||
rb_parser_string_t *str = RNODE_FILE(node)->path;
|
||||
return rb_enc_str_new(str->ptr, str->len, str->enc);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue