[PRISM] Do not respect xflag when eflag is set

This commit is contained in:
Kevin Newton 2024-07-18 11:56:25 -04:00
Родитель 8e5ac5a87d
Коммит b1608fc6bc
1 изменённых файлов: 2 добавлений и 1 удалений

3
ruby.c
Просмотреть файл

@ -2125,10 +2125,10 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result)
if (opt->do_line) command_line |= PM_OPTIONS_COMMAND_LINE_L; if (opt->do_line) command_line |= PM_OPTIONS_COMMAND_LINE_L;
if (opt->do_loop) command_line |= PM_OPTIONS_COMMAND_LINE_N; if (opt->do_loop) command_line |= PM_OPTIONS_COMMAND_LINE_N;
if (opt->do_print) command_line |= PM_OPTIONS_COMMAND_LINE_P; if (opt->do_print) command_line |= PM_OPTIONS_COMMAND_LINE_P;
if (opt->xflag) command_line |= PM_OPTIONS_COMMAND_LINE_X;
VALUE error; VALUE error;
if (strcmp(opt->script, "-") == 0) { if (strcmp(opt->script, "-") == 0) {
if (opt->xflag) command_line |= PM_OPTIONS_COMMAND_LINE_X;
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, "-");
@ -2144,6 +2144,7 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result)
error = pm_parse_string(result, opt->e_script, rb_str_new2("-e")); error = pm_parse_string(result, opt->e_script, rb_str_new2("-e"));
} }
else { else {
if (opt->xflag) command_line |= PM_OPTIONS_COMMAND_LINE_X;
pm_options_command_line_set(options, command_line); pm_options_command_line_set(options, command_line);
error = pm_load_file(result, opt->script_name, true); error = pm_load_file(result, opt->script_name, true);