1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: force_encoding

* parse.y (str_suffix_gen): String#b creates new string object, use
  force_encoding instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-09-02 08:53:40 +00:00
parent a056098cb7
commit 93ea04ecec
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Sep 2 17:53:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (str_suffix_gen): String#b creates new string object, use
force_encoding instead.
Mon Sep 2 16:06:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* NEWS: Add note about frozen string literals

View file

@ -6006,12 +6006,12 @@ parser_str_options(struct parser_params *parser)
switch (c) {
#if STR_OPTION_FROZEN
case 'f':
options |= STR_OPTION_FROZEN;
options |= STR_OPTION_FROZEN;
break;
#endif
#if STR_OPTION_BINARY
case 'b':
options |= STR_OPTION_BINARY;
options |= STR_OPTION_BINARY;
break;
#endif
default:
@ -8576,7 +8576,9 @@ str_suffix_gen(struct parser_params *parser, NODE *node, long opt)
else {
#if STR_OPTION_BINARY
if (opt & STR_OPTION_BINARY) {
node = NEW_CALL(node, rb_intern("b"), 0);
VALUE ascii8bit = rb_enc_from_encoding(rb_ascii8bit_encoding());
NODE *args = NEW_LIST(NEW_LIT(ascii8bit));
node = NEW_CALL(node, rb_intern("force_encoding"), args);
}
#endif
#if STR_OPTION_FROZEN