diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-09-28 23:35:42 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-09-29 09:44:14 +1300 |
commit | 9dd902b83186ad6f9d0a553da2ca114bac6ab7b5 (patch) | |
tree | 1567bf2f43b4cb1306409b5d25aecbde1fe2c90c /iseq.c | |
parent | ac56e5c1ab6eb133102c395f63101060bad6725d (diff) |
Add `eval: true/false` flag to `Coverage.setup`.
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -929,9 +929,11 @@ rb_iseq_new_main(const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_ rb_iseq_t * rb_iseq_new_eval(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth) { - VALUE coverages = rb_get_coverages(); - if (RTEST(coverages) && RTEST(path) && !RTEST(rb_hash_has_key(coverages, path))) { - iseq_setup_coverage(coverages, path, ast, first_lineno - 1); + if (rb_get_coverage_mode() & COVERAGE_TARGET_EVAL) { + VALUE coverages = rb_get_coverages(); + if (RTEST(coverages) && RTEST(path) && !RTEST(rb_hash_has_key(coverages, path))) { + iseq_setup_coverage(coverages, path, ast, first_lineno - 1); + } } return rb_iseq_new_with_opt(ast, name, path, realpath, first_lineno, |