Skip to content

Commit ef9c24b

Browse files
committed
Fix lambda_body
1 parent 77216d1 commit ef9c24b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/codegen_prism.inc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ lambda_body(mrc_codegen_scope *s, mrc_node *tree, mrc_node *body, pm_constant_id
712712
// mandatory
713713
for (i = 0; i < ma; i++) {
714714
if (nint(parameters->requireds.nodes[i]) == PM_MULTI_TARGET_NODE) {
715+
mrc_constant_id_list_append(s, lv, null_mark);
715716
} else {
716717
mrc_constant_id_list_append(s, lv, ((pm_required_parameter_node_t *)parameters->requireds.nodes[i])->name);
717718
}
@@ -732,6 +733,7 @@ lambda_body(mrc_codegen_scope *s, mrc_node *tree, mrc_node *body, pm_constant_id
732733
// post
733734
for (i = 0; i < pa; i++) {
734735
if (nint(parameters->posts.nodes[i]) == PM_MULTI_TARGET_NODE) {
736+
mrc_constant_id_list_append(s, lv, null_mark);
735737
} else {
736738
mrc_constant_id_list_append(s, lv, ((pm_required_parameter_node_t *)parameters->posts.nodes[i])->name);
737739
}
@@ -748,6 +750,7 @@ lambda_body(mrc_codegen_scope *s, mrc_node *tree, mrc_node *body, pm_constant_id
748750
case PM_KEYWORD_REST_PARAMETER_NODE: {
749751
if (((pm_keyword_rest_parameter_node_t *)parameters->keyword_rest)->name) {
750752
mrc_constant_id_list_append(s, lv, ((pm_keyword_rest_parameter_node_t *)parameters->keyword_rest)->name);
753+
write_dastr = false;
751754
}
752755
break;
753756
}
@@ -945,9 +948,9 @@ lambda_body(mrc_codegen_scope *s, mrc_node *tree, mrc_node *body, pm_constant_id
945948
// Enabling the following three lines would generate VM code equivalent to mruby-compiler,
946949
// but it would not work in mruby/c.
947950
// It appears to work correctly even when commented out, so it is left commented out
948-
//uint16_t n = ((pm_multi_target_node_t *)margs[i])->lefts.size;
949-
//gen_move(s, cursp(), pos, 0);
950-
//genop_3(s, OP_APOST, cursp(), n, 0);
951+
uint16_t n = ((pm_multi_target_node_t *)margs[i])->lefts.size;
952+
gen_move(s, cursp(), pos, 0);
953+
genop_3(s, OP_APOST, cursp(), n, 0);
951954
}
952955
pos++;
953956
}
@@ -960,9 +963,9 @@ lambda_body(mrc_codegen_scope *s, mrc_node *tree, mrc_node *body, pm_constant_id
960963
// Enabling the following three lines would generate VM code equivalent to mruby-compiler,
961964
// but it would not work in mruby/c.
962965
// It appears to work correctly even when commented out, so it is left commented out
963-
//uint16_t n = ((pm_multi_target_node_t *)pargs[i])->lefts.size;
964-
//gen_move(s, cursp(), pos, 0);
965-
//genop_3(s, OP_APOST, cursp(), n, 0);
966+
uint16_t n = ((pm_multi_target_node_t *)pargs[i])->lefts.size;
967+
gen_move(s, cursp(), pos, 0);
968+
genop_3(s, OP_APOST, cursp(), n, 0);
966969
}
967970
pos++;
968971
}

0 commit comments

Comments
 (0)