@@ -4330,6 +4330,23 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
43304330 }
43314331 break ;
43324332 }
4333+ if (node -> nd_mid == idAREF &&
4334+ node -> nd_recv != (NODE * )1 &&
4335+ node -> nd_args &&
4336+ nd_type (node -> nd_args ) == NODE_ARRAY &&
4337+ node -> nd_args -> nd_alen == 1 &&
4338+ nd_type (node -> nd_args -> nd_head ) == NODE_STR )
4339+ {
4340+ VALUE str = rb_fstring (node -> nd_args -> nd_head -> nd_lit );
4341+ node -> nd_args -> nd_head -> nd_lit = str ;
4342+ COMPILE (ret , "recv" , node -> nd_recv );
4343+ ADD_INSN2 (ret , line , opt_aref_str ,
4344+ new_callinfo (iseq , idAREF , 1 , 0 , 0 ), str );
4345+ if (poped ) {
4346+ ADD_INSN (ret , line , pop );
4347+ }
4348+ break ;
4349+ }
43334350 case NODE_FCALL :
43344351 case NODE_VCALL :{ /* VCALL: variable or call */
43354352 /*
@@ -5300,6 +5317,25 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
53005317 VALUE flag = 0 ;
53015318 VALUE argc ;
53025319
5320+ if (node -> nd_mid == idASET &&
5321+ node -> nd_recv != (NODE * )1 &&
5322+ node -> nd_args &&
5323+ nd_type (node -> nd_args ) == NODE_ARRAY &&
5324+ node -> nd_args -> nd_alen == 2 &&
5325+ nd_type (node -> nd_args -> nd_head ) == NODE_STR )
5326+ {
5327+ VALUE str = rb_fstring (node -> nd_args -> nd_head -> nd_lit );
5328+ node -> nd_args -> nd_head -> nd_lit = str ;
5329+ COMPILE (ret , "recv" , node -> nd_recv );
5330+ COMPILE (ret , "value" , node -> nd_args -> nd_next -> nd_head );
5331+ ADD_INSN2 (ret , line , opt_aset_str ,
5332+ new_callinfo (iseq , idASET , 2 , 0 , 0 ), str );
5333+ if (poped ) {
5334+ ADD_INSN (ret , line , pop );
5335+ }
5336+ break ;
5337+ }
5338+
53035339 INIT_ANCHOR (recv );
53045340 INIT_ANCHOR (args );
53055341 argc = setup_args (iseq , args , node -> nd_args , & flag );
0 commit comments