summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgen.c4
-rw-r--r--test.toc9
2 files changed, 6 insertions, 7 deletions
diff --git a/cgen.c b/cgen.c
index 0cd5536..7e50024 100644
--- a/cgen.c
+++ b/cgen.c
@@ -1707,7 +1707,7 @@ static bool cgen_val_ptr(CGenerator *g, void *v, Type *t, Location where) {
case BUILTIN_U64: cgen_write(g, "%"PRIu64, *(U64 *)v); break;
case BUILTIN_F32: cgen_write(g, F32_FMT"f", *(F32 *)v); break;
case BUILTIN_F64: cgen_write(g, F64_FMT, *(F64 *)v); break;
- case BUILTIN_CHAR: cgen_write(g, "\\x%02x", *(char *)v); break;
+ case BUILTIN_CHAR: cgen_write(g, "'\\x%02x'", *(char *)v); break;
case BUILTIN_BOOL: cgen_write(g, "%s", *(bool *)v ? "true" : "false"); break;
}
break;
@@ -1752,8 +1752,6 @@ static bool cgen_decl(CGenerator *g, Declaration *d) {
if (!cgen_val_pre(g, *val, type, d->where))
return false;
}
- if (g->block != NULL)
- cgen_write(g, "static ");
if (!cgen_type_pre(g, type, d->where)) return false;
cgen_write(g, " ");
cgen_ident(g, i);
diff --git a/test.toc b/test.toc
index 74980c0..8cb0741 100644
--- a/test.toc
+++ b/test.toc
@@ -1,7 +1,8 @@
-f ::= fn(t::=, x :t) t {
- x + 1
+P ::= struct {
+ x, y:int;
};
-
main ::= fn() {
- f(13);
+ p:P;
+ x::="y";
+ p[x];
}; \ No newline at end of file