diff options
author | Samuel Williams <[email protected]> | 2022-09-17 20:19:57 +1200 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2022-09-22 22:19:12 +1200 |
commit | 9434a7333c2a23c680a977331a60ca7c502c1ac0 (patch) | |
tree | a0715dd55cdab3816b7065a56815017d2d0139c6 /vm_eval.c | |
parent | 4c37eaa979d89be14c2142659daba0588aa64912 (diff) |
Enable coverage for eval.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6396
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1672,6 +1672,8 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind, rb_iseq_t *iseq = NULL; rb_ast_t *ast; int isolated_depth = 0; + int coverage_enabled = Qtrue; + { int depth = 1; const VALUE *ep = vm_block_ep(base_block); @@ -1703,11 +1705,17 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind, rb_gc_register_mark_object(eval_default_path); } fname = eval_default_path; + coverage_enabled = Qfalse; } rb_parser_set_context(parser, parent, FALSE); ast = rb_parser_compile_string_path(parser, fname, src, line); if (ast->body.root) { + if (ast->body.compile_option == Qnil) { + ast->body.compile_option = rb_obj_hide(rb_ident_hash_new()); + } + rb_hash_aset(ast->body.compile_option, rb_sym_intern_ascii_cstr("coverage_enabled"), coverage_enabled); + iseq = rb_iseq_new_eval(&ast->body, ISEQ_BODY(parent)->location.label, fname, Qnil, INT2FIX(line), |