summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 10:38:56 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 10:38:56 +0000
commitd65f7458bc8b4fa4404c41713cfa1ece5260fc8a (patch)
treeedb94c2a2caf7c5727b9b2f87a94db94d8669321 /parse.y
parent52bd0d190042f739a80e76f43e7ef3cbc8ae0969 (diff)
parse.y: remove coverage-related code fragments
The code fragments that initializes coverage data were scattered into both parse.y and compile.c. parse.y allocated a coverage data, and compile.c initialize the data. To remove this cross-cutting concern, this change moves the allocation from "coverage" function of parse.y to "rb_iseq_new_top" of iseq.c. For the sake, parse.y just counts the line number of the original source code, and the number is passed via rb_ast_body_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y24
1 files changed, 2 insertions, 22 deletions
diff --git a/parse.y b/parse.y
index 94f6276134..9971ba0551 100644
--- a/parse.y
+++ b/parse.y
@@ -266,7 +266,6 @@ struct parser_params {
NODE *eval_tree;
VALUE error_buffer;
VALUE debug_lines;
- VALUE coverage;
const struct rb_block *base_block;
#else
/* Ripper only */
@@ -4845,21 +4844,6 @@ debug_lines(VALUE fname)
return 0;
}
-static VALUE
-coverage(VALUE fname, int n)
-{
- VALUE coverages = rb_get_coverages();
- if (RTEST(coverages) && RBASIC(coverages)->klass == 0) {
- VALUE coverage = rb_default_coverage(n);
- VALUE lines = RARRAY_AREF(coverage, COVERAGE_INDEX_LINES);
-
- rb_hash_aset(coverages, fname, coverage);
-
- return lines == Qnil ? Qfalse : lines;
- }
- return 0;
-}
-
static int
e_option_supplied(struct parser_params *p)
{
@@ -4885,7 +4869,6 @@ yycompile0(VALUE arg)
}
if (!e_option_supplied(p)) {
- p->coverage = coverage(p->ruby_sourcefile_string, p->ruby_sourceline);
cov = Qtrue;
}
}
@@ -4899,7 +4882,6 @@ yycompile0(VALUE arg)
n = yyparse(p);
RUBY_DTRACE_PARSE_HOOK(END);
p->debug_lines = 0;
- p->coverage = 0;
p->lex.strterm = 0;
p->lex.pcur = p->lex.pbeg = p->lex.pend = 0;
@@ -4928,6 +4910,7 @@ yycompile0(VALUE arg)
p->ast->body.compile_option = opt;
}
p->ast->body.root = tree;
+ p->ast->body.line_count = p->line_count;
return TRUE;
}
@@ -4989,10 +4972,8 @@ lex_getline(struct parser_params *p)
rb_enc_associate(line, p->enc);
rb_ary_push(p->debug_lines, line);
}
- if (p->coverage) {
- rb_ary_push(p->coverage, Qnil);
- }
#endif
+ p->line_count++;
return line;
}
@@ -5173,7 +5154,6 @@ nextline(struct parser_params *p)
p->heredoc_end = 0;
}
p->ruby_sourceline++;
- p->line_count++;
p->lex.pbeg = p->lex.pcur = RSTRING_PTR(v);
p->lex.pend = p->lex.pcur + RSTRING_LEN(v);
token_flush(p);