aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-10-08 00:33:40 +1300
committerGitHub <noreply@github.com>2022-10-08 00:33:40 +1300
commit24f3e397e957a6747a2067edd831bc7920e204ec (patch)
treec8e88edd04574492619296e934465b7866ee0121 /vm_eval.c
parent1e6cdc76e4b11084f85b2b4718090787a500fd69 (diff)
downloadruby-24f3e397e957a6747a2067edd831bc7920e204ec.tar.gz
Add spec for `Coverage.supported?` and `start(eval: true)`. (#6499)
* Don't emit coverage for eval when eval coverage is disabled.
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_eval.c b/vm_eval.c
index c0558fce2b..a71688c6bc 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -11,6 +11,7 @@
**********************************************************************/
+#include "internal/thread.h"
struct local_var_list {
VALUE tbl;
};
@@ -1672,7 +1673,9 @@ 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;
+
+ // Conditionally enable coverage depending on the current mode:
+ VALUE coverage_enabled = RBOOL(rb_get_coverage_mode() & COVERAGE_TARGET_EVAL);
{
int depth = 1;