commit 27abb47957cb359cc7d3d8a8732d7ecd1f63f647
parent 7b85c1a71cc092ae3fddc1c82a55fcb3cc3fdac0
Author: m21c <ho*******@gmail.com>
Date: Wed, 6 Oct 2021 00:00:51 +0200
minor fixes + cleanup
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -2452,7 +2452,6 @@ readatom(Source *source, int flags)
if (flags & QCONST) {
/* TODO(m21c): const - conversion */
}
-
break;
case KVAR:
@@ -2467,7 +2466,6 @@ readatom(Source *source, int flags)
lhs->type = prim + TBOOL;
lhs->u.u = (uint64_t) (getkind(source) == KTRUE);
gettok(source);
-
break;
case KNULL:
@@ -2476,7 +2474,6 @@ readatom(Source *source, int flags)
lhs->type = maketype(&source->tok.loc, prim + TPTR, prim + TVOID);
lhs->u.u = (uint64_t) (getkind(source) == KTRUE);
gettok(source);
-
break;
case KSTRUCT:
@@ -3290,7 +3287,7 @@ typecheck(Env *env, Node *expr)
switch ((int) expr->kind) {
case OASS:
expr->type = lhs->type;
- return expr;
+ break;
case OMULA: case ODIVA: case OMODA:
case OADDA: case OSUBA:
@@ -3307,7 +3304,7 @@ typecheck(Env *env, Node *expr)
expr->type = prim + TERRTYPE;
}
- return expr;
+ break;
case OLSHA: case ORSHA: case OARSHA:
case OANDA:
@@ -3325,7 +3322,7 @@ typecheck(Env *env, Node *expr)
expr->type = prim + TERRTYPE;
}
- return expr;
+ break;
}
expr->lhs = conv(lhs);
@@ -3612,6 +3609,8 @@ foldexpr(Env *env, Node *expr)
if (lhs->type->kind == expr->type->kind)
*expr = *lhs /*, delete(lhs) */;
+ return expr;
+
case 'T':
error(&expr->loc, "exptected expression, not type");