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

merge revision(s) 64745: [Backport #15118]

Use opt_{aref,aset} over opt_{aref,aset}_with

	* compile.c (iseq_compile_each0): Use `opt_aref`/`opt_aset` over
	  `opt_aref_with`/`opt_aset_with` when frozen_string_literal: true,
	  not to resurrect the index string on non-Hash receiver.

	[Fix GH-1957]

	From: chopraanmol1 <chopraanmol1@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2018-10-17 09:10:26 +00:00
parent f5b0b984b3
commit a04a5fc18b
2 changed files with 3 additions and 1 deletions

View file

@ -5177,6 +5177,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 1 &&
nd_type(node->nd_args->nd_head) == NODE_STR &&
ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
!ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal &&
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit);
node->nd_args->nd_head->nd_lit = str;
@ -6229,6 +6230,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 2 &&
nd_type(node->nd_args->nd_head) == NODE_STR &&
ISEQ_COMPILE_DATA(iseq)->current_block == NULL &&
!ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal &&
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction)
{
VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit);

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.5"
#define RUBY_RELEASE_DATE "2018-10-17"
#define RUBY_PATCHLEVEL 330
#define RUBY_PATCHLEVEL 331
#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 10