summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
Diffstat (limited to 'types.c')
-rw-r--r--types.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/types.c b/types.c
index 8f54b8e..2596596 100644
--- a/types.c
+++ b/types.c
@@ -394,7 +394,13 @@ static bool types_expr(Typer *tr, Expression *e) {
t->flags |= TYPE_FLAG_FLEXIBLE;
break;
case EXPR_LITERAL_STR:
- t->kind = TYPE_UNKNOWN; /* TODO */
+ t->kind = TYPE_ARR;
+ t->arr.n = e->strl.len;
+ t->arr.of = malloc(sizeof *t->arr.of);
+ t->arr.of->flags = TYPE_FLAG_RESOLVED;
+ t->arr.of->kind = TYPE_BUILTIN;
+ t->arr.of->builtin = BUILTIN_CHAR;
+ t->flags |= TYPE_FLAG_RESOLVED;
break;
case EXPR_LITERAL_FLOAT:
t->kind = TYPE_BUILTIN;
@@ -405,6 +411,10 @@ static bool types_expr(Typer *tr, Expression *e) {
t->kind = TYPE_BUILTIN;
t->builtin = BUILTIN_BOOL;
break;
+ case EXPR_LITERAL_CHAR:
+ t->kind = TYPE_BUILTIN;
+ t->builtin = BUILTIN_CHAR;
+ break;
case EXPR_IDENT: {
if (!type_of_ident(tr, e->where, e->ident, t)) return false;
} break;
@@ -781,6 +791,7 @@ static bool types_expr(Typer *tr, Expression *e) {
}
} break;
}
+
return true;
}