Skip to content

Commit d896b6d

Browse files
Fix invalid Java code generation for custom alphabet in MOVE statements (#807)
* fix: invalid Java code generation for custom alphabet in MOVE statements * test: add tests for MOVE with custom alphabet names * test: remove tests for alphabet custom * fix: emit error when ALPHABET name is used as MOVE source
1 parent 5182c48 commit d896b6d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

cobj/codegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ static void joutput_param(cb_tree x, int id) {
16241624
break;
16251625
case CB_ALPHABET_CUSTOM:
16261626
gen_custom = 1;
1627-
joutput("&%s%s", CB_PREFIX_FIELD, rbp->cname);
1627+
joutput("%s%s", CB_PREFIX_FIELD, rbp->cname);
16281628
break;
16291629
}
16301630
if (r->check) {

cobj/typeck.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,7 +4811,8 @@ int validate_move(cb_tree src, cb_tree dst, size_t is_value) {
48114811
case CB_TAG_FIELD:
48124812
case CB_TAG_REFERENCE:
48134813
if (CB_REFERENCE_P(src) && CB_ALPHABET_NAME_P(CB_REFERENCE(src)->value)) {
4814-
break;
4814+
cb_error_x(loc, _("'%s' is not a field"), cb_name(src));
4815+
return -1;
48154816
}
48164817
if (CB_REFERENCE_P(src) && CB_FILE_P(CB_REFERENCE(src)->value)) {
48174818
goto invalid;
@@ -5617,7 +5618,8 @@ cb_tree cb_build_move(cb_tree src, cb_tree dst) {
56175618
}
56185619

56195620
if (CB_REFERENCE_P(src) && CB_ALPHABET_NAME_P(CB_REFERENCE(src)->value)) {
5620-
return cb_build_move_call(src, dst);
5621+
cb_error_x(src, _("'%s' is not a field"), cb_name(src));
5622+
return cb_error_node;
56215623
}
56225624
if (CB_INDEX_P(dst)) {
56235625
if (src == cb_null) {

0 commit comments

Comments
 (0)