@@ -1147,7 +1147,7 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf
1147
1147
}
1148
1148
else {
1149
1149
// If this is not the first splat array seen and it is also
1150
- // the last parameter, we don't want splayarray to dup it
1150
+ // the last parameter, we don't want splatarray to dup it
1151
1151
// and we need to concat the array.
1152
1152
//
1153
1153
// foo(a, *b, *c)
@@ -3110,7 +3110,7 @@ pm_compile_target_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *cons
3110
3110
3111
3111
if (cast -> block != NULL ) {
3112
3112
flags |= VM_CALL_ARGS_BLOCKARG ;
3113
- if (cast -> block != NULL ) pm_compile_node (iseq , cast -> block , writes , src , false, scope_node );
3113
+ if (cast -> block != NULL ) pm_compile_node (iseq , cast -> block , parents , src , false, scope_node );
3114
3114
}
3115
3115
3116
3116
if (state != NULL ) {
@@ -3127,7 +3127,18 @@ pm_compile_target_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *cons
3127
3127
}
3128
3128
}
3129
3129
3130
- ADD_SEND_R (writes , & dummy_line_node , idASET , INT2NUM (argc + 1 ), NULL , INT2FIX (flags ), kwargs );
3130
+ // The argc that we're going to pass to the send instruction is the
3131
+ // number of arguments + 1 for the value being written. If there's a
3132
+ // splat, then we need to insert newarray and concatarray instructions
3133
+ // after the arguments have been written.
3134
+ int ci_argc = argc + 1 ;
3135
+ if (flags & VM_CALL_ARGS_SPLAT ) {
3136
+ ci_argc -- ;
3137
+ ADD_INSN1 (writes , & dummy_line_node , newarray , INT2FIX (1 ));
3138
+ ADD_INSN (writes , & dummy_line_node , concatarray );
3139
+ }
3140
+
3141
+ ADD_SEND_R (writes , & dummy_line_node , idASET , INT2NUM (ci_argc ), NULL , INT2FIX (flags ), kwargs );
3131
3142
ADD_INSN (writes , & dummy_line_node , pop );
3132
3143
3133
3144
if (state != NULL ) {
0 commit comments