commit cfde568e08d3ea202731dd87c6720aab7b6386b1
parent a56678581d9b6a7ac11c117d750142863dffc3b8
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 11 Jan 2021 10:57:16 -0500
gen: implement slice indexing
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -293,7 +293,9 @@ address_index(struct gen_context *ctx,
pushi(ctx->current, out, Q_LOADL, out, NULL);
atype = type_dealias(atype->pointer.referent);
}
- assert(atype->storage == TYPE_STORAGE_ARRAY); // TODO: Slices
+ if (atype->storage == TYPE_STORAGE_SLICE) {
+ pushi(ctx->current, out, Q_LOADL, out, NULL);
+ }
struct qbe_value index = {0};
gen_temp(ctx, &index, &qbe_long, "index.%d");