summaryrefslogtreecommitdiff
path: root/cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'cgen.c')
-rw-r--r--cgen.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cgen.c b/cgen.c
index a498bc3..22ac57d 100644
--- a/cgen.c
+++ b/cgen.c
@@ -698,7 +698,8 @@ static bool cgen_expr_pre(CGenerator *g, Expression *e) {
break;
case EXPR_BINARY_OP:
if (!cgen_expr_pre(g, e->binary.lhs)) return false;
- if (!cgen_expr_pre(g, e->binary.rhs)) return false;
+ if (e->binary.op != BINARY_DOT)
+ if (!cgen_expr_pre(g, e->binary.rhs)) return false;
break;
case EXPR_CAST:
if (!cgen_expr_pre(g, e->cast.expr)) return false;
@@ -862,6 +863,14 @@ static bool cgen_expr(CGenerator *g, Expression *e) {
cgen_write(g, ")");
handled = true;
break;
+ case BINARY_DOT:
+ cgen_write(g, "(");
+ cgen_expr(g, e->binary.lhs);
+ cgen_write(g, ".");
+ cgen_ident(g, e->binary.field->name);
+ cgen_write(g, ")");
+ handled = true;
+ break;
}
if (handled) break;
cgen_write(g, "(");