mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Add line_count field to rb_ast_body_t
This patch adds `int line_count` field to `rb_ast_body_t` structure. Instead, we no longer cast `script_lines` to Fixnum. ## Background Ref https://github.com/ruby/ruby/pull/10618 In the PR above, we have decoupled IMEMO from `rb_ast_t`. This means we could lift the five-words-restriction of the structure that forced us to unionize `rb_ast_t *` and `FIXNUM` in one field. ## Relating refactor - Remove the second parameter of `rb_ruby_ast_new()` function ## Attention I will remove a code that assigns -1 to line_count, in `rb_binding_add_dynavars()` of vm.c, because I don't think it is necessary. But I will make another PR for this so that we can atomically revert in case I was wrong (See the comment on the code)
This commit is contained in:
parent
bf1f16ef47
commit
55a402bb75
9 changed files with 29 additions and 30 deletions
1
ast.c
1
ast.c
|
@ -802,7 +802,6 @@ ast_node_script_lines(rb_execution_context_t *ec, VALUE self)
|
|||
TypedData_Get_Struct(self, struct ASTNodeData, &rb_node_type, data);
|
||||
ast = rb_ruby_ast_data_get(data->vast);
|
||||
rb_parser_ary_t *ret = ast->body.script_lines;
|
||||
if (!ret || FIXNUM_P((VALUE)ret)) return Qnil;
|
||||
return rb_parser_build_script_lines_from(ret);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue