summaryrefslogtreecommitdiff
path: root/src/codegen/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/codegen.c')
-rw-r--r--src/codegen/codegen.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/codegen/codegen.c b/src/codegen/codegen.c
index ebbfdb6..706d613 100644
--- a/src/codegen/codegen.c
+++ b/src/codegen/codegen.c
@@ -655,6 +655,19 @@ void codegen_expression(ParserContext *ctx, ASTNode *node, FILE *out)
}
}
+ if (!is_slice_struct && !node->index.array->type_info && !node->index.array->resolved_type)
+ {
+ char *inferred = infer_type(ctx, node->index.array);
+ if (inferred && strncmp(inferred, "Slice_", 6) == 0)
+ {
+ is_slice_struct = 1;
+ }
+ if (inferred)
+ {
+ free(inferred);
+ }
+ }
+
if (is_slice_struct)
{
if (node->index.array->type == NODE_EXPR_VAR)