1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ruby.c: fix r60393

* ruby.c (load_file_internal): set loop options after parsing
  shebang line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-24 11:09:41 +00:00
parent 49b25aaa22
commit d0d32ba1e8

5
ruby.c
View file

@ -1648,7 +1648,6 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
base_block = toplevel_context(toplevel_binding);
rb_parser_set_context(parser, base_block, TRUE);
rb_parser_set_options(parser, opt->do_print, opt->do_loop, opt->do_line, opt->do_split);
if (opt->e_script) {
VALUE progname = rb_progname;
@ -1673,6 +1672,8 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
require_libraries(&opt->req_list);
}
ruby_set_script_name(progname);
rb_parser_set_options(parser, opt->do_print, opt->do_loop,
opt->do_line, opt->do_split);
tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
}
else {
@ -1885,6 +1886,8 @@ load_file_internal(VALUE argp_v)
else {
enc = rb_utf8_encoding();
}
rb_parser_set_options(parser, opt->do_print, opt->do_loop,
opt->do_line, opt->do_split);
if (NIL_P(f)) {
f = rb_str_new(0, 0);
rb_enc_associate(f, enc);