summaryrefslogtreecommitdiff
path: root/ext/coverage/coverage.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/coverage/coverage.c')
-rw-r--r--ext/coverage/coverage.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index c4070faf56..368f7b1f8c 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -81,16 +81,20 @@ branch_coverage(VALUE branches)
for (i = 0; i < RARRAY_LEN(structure); i++) {
VALUE branches = RARRAY_AREF(structure, i);
VALUE base_type = RARRAY_AREF(branches, 0);
- VALUE base_lineno = RARRAY_AREF(branches, 1);
- VALUE base_column = RARRAY_AREF(branches, 2);
+ VALUE base_first_lineno = RARRAY_AREF(branches, 1);
+ VALUE base_first_column = RARRAY_AREF(branches, 2);
+ VALUE base_last_lineno = RARRAY_AREF(branches, 3);
+ VALUE base_last_column = RARRAY_AREF(branches, 4);
VALUE children = rb_hash_new();
- rb_hash_aset(ret, rb_ary_new_from_args(4, base_type, LONG2FIX(id++), base_lineno, base_column), children);
- for (j = 3; j < RARRAY_LEN(branches); j += 4) {
+ rb_hash_aset(ret, rb_ary_new_from_args(6, base_type, LONG2FIX(id++), base_first_lineno, base_first_column, base_last_lineno, base_last_column), children);
+ for (j = 5; j < RARRAY_LEN(branches); j += 6) {
VALUE target_label = RARRAY_AREF(branches, j);
- VALUE target_lineno = RARRAY_AREF(branches, j + 1);
- VALUE target_column = RARRAY_AREF(branches, j + 2);
- int idx = FIX2INT(RARRAY_AREF(branches, j + 3));
- rb_hash_aset(children, rb_ary_new_from_args(4, target_label, LONG2FIX(id++), target_lineno, target_column), RARRAY_AREF(counters, idx));
+ VALUE target_first_lineno = RARRAY_AREF(branches, j + 1);
+ VALUE target_first_column = RARRAY_AREF(branches, j + 2);
+ VALUE target_last_lineno = RARRAY_AREF(branches, j + 3);
+ VALUE target_last_column = RARRAY_AREF(branches, j + 4);
+ int idx = FIX2INT(RARRAY_AREF(branches, j + 5));
+ rb_hash_aset(children, rb_ary_new_from_args(6, target_label, LONG2FIX(id++), target_first_lineno, target_first_column, target_last_lineno, target_last_column), RARRAY_AREF(counters, idx));
}
}