summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-10 22:39:01 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-10 22:39:01 -0500
commit56a9ba5ea53a5d0b6268939d6a6e89837c2e4658 (patch)
tree2e3aa79b863a1c8c858a504764260b3614ba9d1c /eval.c
parent17f78f57b2225840144b7b9027e3e032684c4cb0 (diff)
made Field.type not a pointer
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index e13c5ba..0eab329 100644
--- a/eval.c
+++ b/eval.c
@@ -65,7 +65,7 @@ static void eval_struct_find_offsets(Type *t) {
size_t bytes = 0;
size_t total_align = 0;
arr_foreach(t->struc->fields, Field, f) {
- size_t falign = compiler_alignof(f->type);
+ size_t falign = compiler_alignof(&f->type);
if (falign > total_align)
total_align = falign;
/* align */
@@ -73,7 +73,7 @@ static void eval_struct_find_offsets(Type *t) {
assert(bytes % falign == 0);
f->offset = bytes;
/* add size */
- bytes += compiler_sizeof(f->type);
+ bytes += compiler_sizeof(&f->type);
}
bytes += ((total_align - bytes) % total_align + total_align) % total_align; /* = -bytes mod align */
t->struc->size = bytes;
@@ -344,7 +344,7 @@ static void fprint_val_ptr(FILE *f, void *p, Type *t) {
fprintf(f, ", ");
fprint_ident_debug(f, fi->name);
fprintf(f, ": ");
- fprint_val_ptr(f, (char *)p + fi->offset, fi->type);
+ fprint_val_ptr(f, (char *)p + fi->offset, &fi->type);
}
fprintf(f, "]");
break;
@@ -843,7 +843,7 @@ static bool eval_set(Evaluator *ev, Expression *set, Value *to) {
case BINARY_DOT: {
void *ptr = eval_ptr_to_struct_field(ev, set);
if (!ptr) return false;
- eval_deref_set(ptr, to, set->binary.field->type);
+ eval_deref_set(ptr, to, &set->binary.field->type);
} break;
default: assert(0); break;
}