diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:19:59 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:19:59 -0400 |
| commit | 6e5fb2ac4e5b780c74f310446ddd80d571170b0d (patch) | |
| tree | 587241a69065c01b890d7ae70a37af08bba646b1 /src/compile/assignments.c | |
| parent | 3cd3b20f58e9d2c6463d503be09e5d4cfaadee6c (diff) | |
More code cleanups
Diffstat (limited to 'src/compile/assignments.c')
| -rw-r--r-- | src/compile/assignments.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compile/assignments.c b/src/compile/assignments.c index 921b5320..74d1b543 100644 --- a/src/compile/assignments.c +++ b/src/compile/assignments.c @@ -161,6 +161,7 @@ Text_t compile_lvalue(env_t *env, ast_t *ast) { container_t = value_type(container_t); type_t *index_t = get_type(env, index->index); if (container_t->tag == ListType) { + if (!index->index) code_err(ast, "This list needs an index"); Text_t target_code = compile_to_pointer_depth(env, index->indexed, 1, false); type_t *item_type = Match(container_t, ListType)->item_type; Text_t index_code = @@ -171,6 +172,7 @@ Text_t compile_lvalue(env_t *env, ast_t *ast) { return Texts("List_lvalue(", compile_type(item_type), ", ", target_code, ", ", index_code, ", ", (int64_t)(ast->start - ast->file->text), ", ", (int64_t)(ast->end - ast->file->text), ")"); } else if (container_t->tag == TableType) { + if (!index->index) code_err(ast, "This table needs an index"); DeclareMatch(table_type, container_t, TableType); if (table_type->default_value) { type_t *value_type = get_type(env, table_type->default_value); |
