harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ae5d1492884997ae3036dbc24a4a111bec67a5a4
parent 35d94d17602bb802231b2c42fad1757f5f60a226
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  3 Aug 2021 09:37:02 +0200

gen: implement auto-deref

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Msrc/gen.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -141,8 +141,10 @@ gen_load(struct gen_context *ctx, struct gen_value object) static struct gen_value gen_autoderef(struct gen_context *ctx, struct gen_value val) { - // TODO - assert(type_dealias(val.type)->storage != STORAGE_POINTER); + while (type_dealias(val.type)->storage == STORAGE_POINTER) { + val.type = type_dealias(val.type)->pointer.referent; + val = gen_load(ctx, val); + } return val; }