summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-09-28 23:35:42 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-09-29 09:44:14 +1300
commit9dd902b83186ad6f9d0a553da2ca114bac6ab7b5 (patch)
tree1567bf2f43b4cb1306409b5d25aecbde1fe2c90c /iseq.c
parentac56e5c1ab6eb133102c395f63101060bad6725d (diff)
downloadruby-9dd902b83186ad6f9d0a553da2ca114bac6ab7b5.tar.gz
Add `eval: true/false` flag to `Coverage.setup`.
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/iseq.c b/iseq.c
index 0d4e014999..5b1d9de106 100644
--- a/iseq.c
+++ b/iseq.c
@@ -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,