[PRISM] Enable coverage in eval ISEQs

This commit is contained in:
Kevin Newton 2024-04-25 08:50:23 -04:00
Родитель 49764869af
Коммит 94d6295b2d
2 изменённых файлов: 9 добавлений и 3 удалений

7
iseq.c
Просмотреть файл

@ -952,6 +952,13 @@ rb_iseq_t *
pm_iseq_new_eval(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath,
int first_lineno, const rb_iseq_t *parent, int isolated_depth)
{
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, ((int) (node->parser->newline_list.size - 1)) + first_lineno - 1);
}
}
return pm_iseq_new_with_opt(node, name, path, realpath, first_lineno,
parent, isolated_depth, ISEQ_TYPE_EVAL, &COMPILE_OPTION_DEFAULT);
}

Просмотреть файл

@ -25,5 +25,4 @@ MSpec.register(:exclude, "TracePoint#path equals \"(eval at __FILE__:__LINE__)\"
## Library
MSpec.register(:exclude, "Coverage.result returns the correct results when eval coverage is disabled")
MSpec.register(:exclude, "Coverage.start measures coverage within eval")
MSpec.register(:exclude, "Socket.gethostbyaddr using an IPv6 address with an explicit address family raises SocketError when the address is not supported by the family")