aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 03:36:05 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 03:36:05 +0000
commit38d48305d307afcfdb8f857258c01958d8f83275 (patch)
tree44b0d3e955800742f25a4d9f887cd0008c7d161d /compile.c
parent39ece65987ca7c4588c935a1ca7ded0426916ad7 (diff)
downloadruby-38d48305d307afcfdb8f857258c01958d8f83275.tar.gz
Add branch coverage for while and until statements
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 0b3890db4b..aed9bd6e78 100644
--- a/compile.c
+++ b/compile.c
@@ -4389,6 +4389,7 @@ compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popped, co
LABEL *prev_end_label = ISEQ_COMPILE_DATA(iseq)->end_label;
LABEL *prev_redo_label = ISEQ_COMPILE_DATA(iseq)->redo_label;
int prev_loopval_popped = ISEQ_COMPILE_DATA(iseq)->loopval_popped;
+ VALUE branches;
struct iseq_compile_data_ensure_node_stack enl;
@@ -4419,6 +4420,8 @@ compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popped, co
if (tmp_label) ADD_LABEL(ret, tmp_label);
ADD_LABEL(ret, redo_label);
+ DECL_BRANCH_BASE(branches, line, type == NODE_WHILE ? "while" : "until");
+ ADD_TRACE_BRANCH_COVERAGE(ret, node->nd_body ? nd_line(node->nd_body) : line, "body", branches);
CHECK(COMPILE_POPPED(ret, "while body", node->nd_body));
ADD_LABEL(ret, next_label); /* next */