Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add line_count field to rb_ast_body_t #10655

Merged
merged 1 commit into from Apr 27, 2024

Conversation

hasumikin
Copy link
Contributor

Aiming to improve maintainability and readability, this patch adds int line_count field to rb_ast_body_t structure.
Instead, we no longer cast script_lines to Fixnum.

Background

Ref #10618

In the PR above, we have decoupled IMEMO from rb_ast_t. This means we could lift the five-word 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 patch adds `int line_count` field to `rb_ast_body_t` structure.
Instead, we no longer cast `script_lines` to Fixnum.

## Background

Ref ruby#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)
@yui-knk yui-knk merged commit 55a402b into ruby:master Apr 27, 2024
101 checks passed
@hasumikin hasumikin deleted the ast-body-line_count branch April 27, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants