Remove prism compiler warning
This commit is contained in:
parent
caac56584c
commit
792e9c46a4
27
ruby.c
27
ruby.c
@ -2098,27 +2098,6 @@ process_script(ruby_cmdline_options_t *opt)
|
|||||||
return ast_value;
|
return ast_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Call ruby_opt_init to set up the global state based on the command line
|
|
||||||
* options, and then warn if prism is enabled and the experimental warning
|
|
||||||
* category is enabled.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
prism_opt_init(ruby_cmdline_options_t *opt)
|
|
||||||
{
|
|
||||||
ruby_opt_init(opt);
|
|
||||||
|
|
||||||
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) {
|
|
||||||
rb_category_warn(
|
|
||||||
RB_WARN_CATEGORY_EXPERIMENTAL,
|
|
||||||
"The compiler based on the Prism parser is currently experimental "
|
|
||||||
"and compatibility with the compiler based on parse.y is not yet "
|
|
||||||
"complete. Please report any issues you find on the `ruby/prism` "
|
|
||||||
"issue tracker."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the command line options and parse the script into the given result.
|
* Process the command line options and parse the script into the given result.
|
||||||
* Raise an error if the script cannot be parsed.
|
* Raise an error if the script cannot be parsed.
|
||||||
@ -2147,14 +2126,14 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result)
|
|||||||
pm_options_command_line_set(options, command_line);
|
pm_options_command_line_set(options, command_line);
|
||||||
pm_options_filepath_set(options, "-");
|
pm_options_filepath_set(options, "-");
|
||||||
|
|
||||||
prism_opt_init(opt);
|
ruby_opt_init(opt);
|
||||||
error = pm_parse_stdin(result);
|
error = pm_parse_stdin(result);
|
||||||
}
|
}
|
||||||
else if (opt->e_script) {
|
else if (opt->e_script) {
|
||||||
command_line |= PM_OPTIONS_COMMAND_LINE_E;
|
command_line |= PM_OPTIONS_COMMAND_LINE_E;
|
||||||
pm_options_command_line_set(options, command_line);
|
pm_options_command_line_set(options, command_line);
|
||||||
|
|
||||||
prism_opt_init(opt);
|
ruby_opt_init(opt);
|
||||||
result->node.coverage_enabled = 0;
|
result->node.coverage_enabled = 0;
|
||||||
error = pm_parse_string(result, opt->e_script, rb_str_new2("-e"));
|
error = pm_parse_string(result, opt->e_script, rb_str_new2("-e"));
|
||||||
}
|
}
|
||||||
@ -2166,7 +2145,7 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result)
|
|||||||
// line options. We do it in this order so that if the main script fails
|
// line options. We do it in this order so that if the main script fails
|
||||||
// to load, it doesn't require files required by -r.
|
// to load, it doesn't require files required by -r.
|
||||||
if (NIL_P(error)) {
|
if (NIL_P(error)) {
|
||||||
prism_opt_init(opt);
|
ruby_opt_init(opt);
|
||||||
error = pm_parse_file(result, opt->script_name);
|
error = pm_parse_file(result, opt->script_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,11 +302,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_parser_flag
|
def test_parser_flag
|
||||||
warning = /compiler based on the Prism parser is currently experimental/
|
assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), [])
|
||||||
|
assert_in_out_err(%w(--parser=prism --dump=parsetree -e _=:hi), "", /"hi"/, [])
|
||||||
assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), warning)
|
|
||||||
assert_in_out_err(%w(--parser=prism -W:no-experimental -e) + ["puts :hi"], "", %w(hi), [])
|
|
||||||
assert_in_out_err(%w(--parser=prism -W:no-experimental --dump=parsetree -e _=:hi), "", /"hi"/, [])
|
|
||||||
|
|
||||||
assert_in_out_err(%w(--parser=parse.y -e) + ["puts :hi"], "", %w(hi), [])
|
assert_in_out_err(%w(--parser=parse.y -e) + ["puts :hi"], "", %w(hi), [])
|
||||||
assert_norun_with_rflag('--parser=parse.y', '--version', "")
|
assert_norun_with_rflag('--parser=parse.y', '--version', "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user