From f540475134ea5aded740205631c0e9cea081c654 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 26 Jun 2016 23:56:57 +0000 Subject: Coverage on non-positive lines * compile.c (ADD_TRACE): ignore trace instruction on non-positive line. * parse.y (coverage): get rid of ArgumentError when the starting line number is not positive. [ruby-core:76141] [Bug #12517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 362dea7721..064aee8aea 100644 --- a/parse.y +++ b/parse.y @@ -5493,7 +5493,7 @@ coverage(VALUE fname, int n) { VALUE coverages = rb_get_coverages(); if (RTEST(coverages) && RBASIC(coverages)->klass == 0) { - VALUE lines = rb_ary_tmp_new_fill(n); + VALUE lines = n > 0 ? rb_ary_tmp_new_fill(n) : rb_ary_tmp_new(0); rb_hash_aset(coverages, fname, lines); return lines; } -- cgit v1.2.3