summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
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