summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-12-10 10:35:14 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-12-10 10:35:14 -0500
commitbc009f5a471e632470861820c74c7a3bbac06961 (patch)
treedc60ecc43f5e6ef6284a77922e438a96b1b5dc5c /types.c
parente73b5a6cb8930d8fc46edd0112d1e292746b7ada (diff)
made Expression smaller
Diffstat (limited to 'types.c')
-rw-r--r--types.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/types.c b/types.c
index fa8c626..1b3d8b2 100644
--- a/types.c
+++ b/types.c
@@ -385,7 +385,7 @@ static bool type_of_ident(Typer *tr, Location where, Identifier i, Type *t) {
} else {
if ((d->flags & DECL_HAS_EXPR) && (d->expr.kind == EXPR_FN)) {
/* allow using a function before declaring it */
- if (!type_of_fn(tr, &d->expr.fn, d->expr.where, t, 0)) return false;
+ if (!type_of_fn(tr, d->expr.fn, d->expr.where, t, 0)) return false;
return true;
} else {
if (location_after(d->where, where)) {
@@ -417,12 +417,12 @@ static bool type_of_ident(Typer *tr, Location where, Identifier i, Type *t) {
switch (e->kind) {
case EXPR_EACH:
- if (i == e->each.index) {
+ if (i == e->each->index) {
t->kind = TYPE_BUILTIN;
t->builtin = BUILTIN_I64;
} else {
- assert(i == e->each.value);
- *t = e->each.type;
+ assert(i == e->each->value);
+ *t = e->each->type;
}
break;
default: assert(0); return false;
@@ -717,13 +717,13 @@ static bool types_expr(Typer *tr, Expression *e) {
e->flags |= EXPR_FOUND_TYPE; /* even if failed, pretend we found the type */
switch (e->kind) {
case EXPR_FN: {
- if (!type_of_fn(tr, &e->fn, e->where, &e->type, 0))
+ if (!type_of_fn(tr, e->fn, e->where, &e->type, 0))
return false;
- if (fn_has_any_const_params(&e->fn)) {
+ if (fn_has_any_const_params(e->fn)) {
HashTable z = {0};
- e->fn.instances = z;
+ e->fn->instances = z;
} else {
- if (!types_fn(tr, &e->fn, &e->type, e->where, NULL))
+ if (!types_fn(tr, e->fn, &e->type, e->where, NULL))
return false;
}
} break;
@@ -757,7 +757,7 @@ static bool types_expr(Typer *tr, Expression *e) {
t->flags |= TYPE_IS_RESOLVED;
break;
case EXPR_EACH: {
- EachExpr *ea = &e->each;
+ EachExpr *ea = e->each;
*(Expression **)arr_add(&tr->in_expr_decls) = e;
if (!each_enter(e)) return false;
if (ea->flags & EACH_IS_RANGE) {
@@ -1040,7 +1040,7 @@ static bool types_expr(Typer *tr, Expression *e) {
if (decl->decl->flags & DECL_HAS_EXPR) {
Expression *expr = &decl->decl->expr;
if (expr->kind == EXPR_FN)
- fn_decl = &decl->decl->expr.fn;
+ fn_decl = decl->decl->expr.fn;
}
}
}