diff options
author | Kevin Newton <[email protected]> | 2024-05-20 11:29:50 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-05-20 12:28:47 -0400 |
commit | a708b6aa6589b06ed059ad40e7d4e71ebe0e16e3 () | |
tree | 1691cf10b4ed6f21d2081241f8801a874b8ea9eb | |
parent | 78e504f21d3148b7b6fa78ea70d10426170f4112 (diff) |
[PRISM] Respect eval coverage setting
-rw-r--r-- | iseq.c | 7 | ||||
-rw-r--r-- | load.c | 1 | ||||
-rw-r--r-- | prism_compile.c | 4 | ||||
-rw-r--r-- | prism_compile.h | 8 | ||||
-rw-r--r-- | ruby.c | 1 | ||||
-rw-r--r-- | vm_eval.c | 7 |
6 files changed, 25 insertions, 3 deletions
@@ -1029,8 +1029,13 @@ pm_iseq_new_with_opt(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpa ISEQ_BODY(iseq)->prism = true; ISEQ_BODY(iseq)->param.flags.use_block = true; // unused block warning is not supported yet if (!option) option = &COMPILE_OPTION_DEFAULT; pm_location_t *location = &node->base.location; int32_t start_line = node->parser->start_line; @@ -1273,6 +1278,7 @@ pm_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, V pm_parse_result_t result = { 0 }; pm_options_line_set(&result.options, NUM2INT(line)); switch (option.frozen_string_literal) { case ISEQ_FROZEN_STRING_LITERAL_UNSET: @@ -1708,6 +1714,7 @@ iseqw_s_compile_file_prism(int argc, VALUE *argv, VALUE self) pm_parse_result_t result = { 0 }; result.options.line = 1; VALUE error = pm_load_parse_file(&result, file); @@ -746,6 +746,7 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname) if (*rb_ruby_prism_ptr()) { pm_parse_result_t result = { 0 }; result.options.line = 1; VALUE error = pm_load_parse_file(&result, fname); @@ -2868,6 +2868,7 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_ scope->encoding = previous->encoding; scope->filepath_encoding = previous->filepath_encoding; scope->constants = previous->constants; } switch (PM_NODE_TYPE(node)) { @@ -9299,6 +9300,7 @@ pm_parse_process(pm_parse_result_t *result, pm_node_t *node) // freed regardless of whether or we return an error. pm_scope_node_t *scope_node = &result->node; rb_encoding *filepath_encoding = scope_node->filepath_encoding; pm_scope_node_init(node, scope_node, NULL); scope_node->filepath_encoding = filepath_encoding; @@ -9306,6 +9308,8 @@ pm_parse_process(pm_parse_result_t *result, pm_node_t *node) scope_node->encoding = rb_enc_find(parser->encoding->name); if (!scope_node->encoding) rb_bug("Encoding not found %s!", parser->encoding->name); // Emit all of the various warnings from the parse. const pm_diagnostic_t *warning; const char *warning_filepath = (const char *) pm_string_source(&parser->filepath); @@ -36,14 +36,16 @@ typedef struct pm_scope_node { */ rb_encoding *filepath_encoding; - // The size of the local table - // on the iseq which includes - // locals and hidden variables int local_table_for_iseq_size; ID *constants; st_table *index_lookup_table; /** * This will only be set on the top-level scope node. It will contain all of * the instructions pertaining to BEGIN{} nodes. @@ -2155,6 +2155,7 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result) pm_options_command_line_set(options, command_line); prism_opt_init(opt); error = pm_parse_string(result, opt->e_script, rb_str_new2("-e")); } else { @@ -1629,6 +1629,10 @@ pm_eval_make_iseq(VALUE src, VALUE fname, int line, const rb_iseq_t *const parent = vm_block_iseq(base_block); const rb_iseq_t *iseq = parent; VALUE name = rb_fstring_lit("<compiled>"); if (!fname) { fname = rb_source_location(&line); } @@ -1638,10 +1642,12 @@ pm_eval_make_iseq(VALUE src, VALUE fname, int line, } else { fname = get_eval_default_path(); } pm_parse_result_t result = { 0 }; pm_options_line_set(&result.options, line); // Cout scopes, one for each parent iseq, plus one for our local scope int scopes_count = 0; @@ -1703,6 +1709,7 @@ pm_eval_make_iseq(VALUE src, VALUE fname, int line, RUBY_ASSERT(parent_scope != NULL); pm_options_scope_t *options_scope = &result.options.scopes[scopes_count - scopes_index - 1]; parent_scope->parser = &result.parser; parent_scope->index_lookup_table = st_init_numtable(); |