diff options
author | yui-knk <[email protected]> | 2023-06-17 10:21:37 +0900 |
---|---|---|
committer | Yuichiro Kaneko <[email protected]> | 2023-06-17 16:41:08 +0900 |
commit | 19c62b400d3458c4525f174515bcb616af7dfdfe (patch) | |
tree | 59a687fc1573a545cc21f6b529724cd7821a0df8 /iseq.c | |
parent | e5ae7a16b49d4cf7c7069aeb01ed5c4e58152055 (diff) |
Replace parser & node compile_option from Hash to bit field
This commit reduces dependency to CRuby object.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7950
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -741,6 +741,15 @@ set_compile_option_from_hash(rb_compile_option_t *option, VALUE opt) #undef SET_COMPILE_OPTION_NUM } +static VALUE +make_compile_option_from_ast(const rb_ast_body_t *ast) +{ + VALUE opt = rb_obj_hide(rb_ident_hash_new()); + if (ast->frozen_string_literal >= 0) rb_hash_aset(opt, rb_sym_intern_ascii_cstr("frozen_string_literal"), RBOOL(ast->frozen_string_literal)); + if (ast->coverage_enabled >= 0) rb_hash_aset(opt, rb_sym_intern_ascii_cstr("coverage_enabled"), RBOOL(ast->coverage_enabled)); + return opt; +} + static void rb_iseq_make_compile_option(rb_compile_option_t *option, VALUE opt) { @@ -908,7 +917,7 @@ rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE rea else { new_opt = COMPILE_OPTION_DEFAULT; } - if (ast && ast->compile_option) rb_iseq_make_compile_option(&new_opt, ast->compile_option); + if (ast) rb_iseq_make_compile_option(&new_opt, make_compile_option_from_ast(ast)); VALUE script_lines = Qnil; |