* ruby.c (process_options): set primary encoding from the parser

always.  [ruby-core:12758]

* ruby.c (load_file): should not discard the parser parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-19 02:09:57 +00:00
Родитель 5725135274
Коммит a4e493a985
2 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Fri Oct 19 11:09:56 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (process_options): set primary encoding from the parser
always. [ruby-core:12758]
* ruby.c (load_file): should not discard the parser parameter.
Fri Oct 19 10:55:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Oct 19 10:55:42 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* range.c (range_last): removed unused variables. * range.c (range_last): removed unused variables.

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

@ -842,7 +842,6 @@ process_options(VALUE arg)
char **argv = opt->argv; char **argv = opt->argv;
NODE *tree = 0; NODE *tree = 0;
VALUE parser; VALUE parser;
VALUE encoding;
const char *s; const char *s;
int i = proc_options(argc, argv, opt); int i = proc_options(argc, argv, opt);
@ -970,13 +969,7 @@ process_options(VALUE arg)
} }
} }
if (opt->enc_index >= 0) { rb_set_primary_encoding(rb_parser_encoding(parser));
encoding = rb_enc_from_encoding(rb_enc_from_index(opt->enc_index));
}
else {
encoding = rb_parser_encoding(parser);
}
rb_set_primary_encoding(encoding);
return (VALUE)tree; return (VALUE)tree;
} }
@ -1097,7 +1090,6 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o
require_libraries(); /* Why here? unnatural */ require_libraries(); /* Why here? unnatural */
} }
if (opt->enc_index >= 0) rb_enc_associate_index(f, opt->enc_index); if (opt->enc_index >= 0) rb_enc_associate_index(f, opt->enc_index);
parser = rb_parser_new();
tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start); tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
if (script && rb_parser_end_seen_p(parser)) { if (script && rb_parser_end_seen_p(parser)) {
rb_define_global_const("DATA", f); rb_define_global_const("DATA", f);