Project

General

Profile

Bug #8776 » script_name.patch

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

View differences:

parse.y (working copy)
5450 5450
rb_compile_string(const char *f, VALUE s, int line)
5451 5451
{
5452 5452
    must_be_ascii_compatible(s);
5453
    return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line);
5453
    return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line);
5454 5454
}
5455 5455

  
5456 5456
NODE*
5457 5457
rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
5458 5458
{
5459
    return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line);
5459
    return rb_parser_compile_string_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), s, line);
5460 5460
}
5461 5461

  
5462 5462
NODE*
......
5470 5470
rb_compile_cstr(const char *f, const char *s, int len, int line)
5471 5471
{
5472 5472
    VALUE str = rb_str_new(s, len);
5473
    return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line);
5473
    return parser_compile_string(rb_parser_new(), rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line);
5474 5474
}
5475 5475

  
5476 5476
NODE*
5477 5477
rb_parser_compile_cstr(volatile VALUE vparser, const char *f, const char *s, int len, int line)
5478 5478
{
5479 5479
    VALUE str = rb_str_new(s, len);
5480
    return parser_compile_string(vparser, rb_filesystem_str_new_cstr(f), str, line);
5480
    return parser_compile_string(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), str, line);
5481 5481
}
5482 5482

  
5483 5483
static VALUE
......
5497 5497
NODE*
5498 5498
rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start)
5499 5499
{
5500
    return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start);
5500
    return rb_parser_compile_file_path(vparser, rb_enc_str_new(f, strlen(f), rb_default_internal_encoding()), file, start);
5501 5501
}
5502 5502

  
5503 5503
NODE*
ruby.c (working copy)
1466 1475
    th->parse_in_eval++; \
1467 1476
    th->base_block = 0; \
1468 1477
} while (0)
1478
    
1479
    opt->script_name = rb_str_encode_ospath(opt->script_name);
1480
    opt->script = RSTRING_PTR(opt->script_name);
1481
    ruby_set_script_name(opt->script_name);
1469 1482

  
1470 1483
    if (opt->e_script) {
1471 1484
	VALUE progname = rb_progname;