From f6b4cba666b1cfb6dc6f8e2f9d57928c6d640ba5 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Feb 2011 17:09:45 +0000 Subject: * parse.y (lex_getline, parser_set_encode): set encoding of lines in SCRIPT_LINES__ as source encoding. [ruby-dev:43168] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index b4ee019a0f..a819c4852c 100644 --- a/parse.y +++ b/parse.y @@ -5220,6 +5220,7 @@ lex_getline(struct parser_params *parser) must_be_ascii_compatible(line); #ifndef RIPPER if (ruby_debug_lines) { + rb_enc_associate(line, parser->enc); rb_ary_push(ruby_debug_lines, line); } if (ruby_coverage) { @@ -6246,6 +6247,15 @@ parser_set_encode(struct parser_params *parser, const char *name) goto error; } parser->enc = enc; +#ifndef RIPPER + if (ruby_debug_lines) { + long i, n = RARRAY_LEN(ruby_debug_lines); + const VALUE *p = RARRAY_PTR(ruby_debug_lines); + for (i = 0; i < n; ++i) { + rb_enc_associate_index(*p, idx); + } + } +#endif } static int -- cgit v1.2.3