Skip to content

Commit dd82926

Browse files
committed
fix: Issue #28
1 parent 5e9dc7b commit dd82926

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cobc/codegen.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,6 +3404,7 @@ joutput_stmt (cb_tree x)
34043404
#endif
34053405
int code;
34063406
struct cb_field *f;
3407+
int putParen = 0;
34073408

34083409
stack_id = 0;
34093410
if (x == NULL) {
@@ -3740,11 +3741,21 @@ joutput_stmt (cb_tree x)
37403741
joutput (";\n");
37413742
break;
37423743
case CB_TAG_LIST:
3743-
joutput_indent ("{");
3744+
if(x && CB_TREE_TAG(CB_VALUE(x)) == CB_TAG_PERFORM) {
3745+
putParen = 0;
3746+
} else {
3747+
putParen = 1;
3748+
joutput_indent ("{");
3749+
}
3750+
37443751
for (; x; x = CB_CHAIN (x)) {
37453752
joutput_stmt (CB_VALUE (x));
37463753
}
3747-
joutput_indent ("}");
3754+
3755+
if(putParen) {
3756+
joutput_indent ("}");
3757+
}
3758+
37483759
break;
37493760
default:
37503761
fprintf (stderr, "Unexpected tree tag %d\n", CB_TREE_TAG (x));

0 commit comments

Comments
 (0)