Project

General

Profile

Bug #8776 » script_name.patch

jiayp@glodon.com (贾 延平), 08/11/2013 04:17 PM

View differences:

parse.y (working copy)
rb_compile_string(const char *f, VALUE s, int line)
{
must_be_ascii_compatible(s);
return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line);
return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line);
}
NODE*
rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
{
return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line);
return rb_parser_compile_string_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line);
}
NODE*
......
rb_compile_cstr(const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line);
return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line);
}
NODE*
rb_parser_compile_cstr(volatile VALUE vparser, const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
return parser_compile_string(vparser, rb_filesystem_str_new_cstr(f), str, line);
return parser_compile_string(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line);
}
static VALUE
......
NODE*
rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start)
{
return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start);
return rb_parser_compile_file_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), file, start);
}
NODE*
ruby.c (working copy)
th->parse_in_eval++; \
th->base_block = 0; \
} while (0)
opt->script_name = rb_str_encode_ospath(opt->script_name);
opt->script = RSTRING_PTR(opt->script_name);
ruby_set_script_name(opt->script_name);
if (opt->e_script) {
VALUE progname = rb_progname;
    (1-1/1)