./oceani --noexec --print .tmp.code1a >> .tmp.code2a || exit 1;\
if ! cmp -s .tmp.code1 .tmp.code2a; then \
echo " Failed"; diff -u .tmp.code1 .tmp.code2a; exit 1; fi ; \
+ echo -n "brackets.. "; \
+ echo '``````' > .tmp.code2b ; echo '``````' > .tmp.code2c ;\
+ ./oceani --noexec --print --brackets .tmp.code1 >> .tmp.code2b || exit 1; \
+ ./oceani -npb .tmp.code2b >> .tmp.code2c || exit 1 ; \
+ if ! cmp -s .tmp.code2b .tmp.code2c; then \
+ echo " Failed"; diff -u .tmp.code2b .tmp.code2c; exit 1; fi; \
echo -n "exec-after-print.. "; \
./oceani .tmp.code1 $${1+"$$@"} > .tmp.have ; \
if ! cmp -s .tmp.want .tmp.have; then \
static void function_print(struct type *type, struct value *val, FILE *f)
{
+ fprintf(f, "\n");
print_exec(val->function, 1, 0);
}
} else
type_print(type->function.return_type, f);
}
- fprintf(f, "\n");
}
static void function_free_type(struct type *t)
if (bracket) printf(")");
break;
case Bracket:
- printf("(");
+ /* Avoid double brackets... */
+ if (!bracket) printf("(");
print_exec(b->right, indent, bracket);
- printf(")");
+ if (!bracket) printf(")");
break;
###### propagate binode cases
struct value *val = var_value(&context, v);
printf("func %.*s", v->name->name.len, v->name->name.txt);
v->type->print_type_decl(v->type, stdout);
- if (brackets)
- print_exec(val->function, 0, brackets);
- else
+ if (brackets) {
+ printf(" {\n");
+ print_exec(val->function, 1, brackets);
+ printf("}\n");
+ } else {
print_value(v->type, val, stdout);
+ }
printf("/* frame size %d */\n", v->type->function.local_size);
target -= 1;
}