summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-04 17:09:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-04 17:09:45 +0000
commitf6b4cba666b1cfb6dc6f8e2f9d57928c6d640ba5 (patch)
treeaf53039f659ca5d9f3d0396e4ffee797f7cf534d /parse.y
parent0958923530594873703ccaec9ab92aa623f5578f (diff)
* 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
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 10 insertions, 0 deletions
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