diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 14:22:58 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 14:22:58 -0400 |
| commit | ff4ea60daf8a97d07a5b0419c05441d7312a1901 (patch) | |
| tree | 3bb7f991ae7bbe4ad3a703c5df09c0d5625b19ca /typecheck.c | |
| parent | adccc5688062271ca6999a15d6c09bd106462704 (diff) | |
Tweaks to array implementation, including changing how the bits are
allocated, making more explicit checks for refcounts and max values,
optimizations for certain methods, and adding compile-time errors for
arrays that hold items that are too large.
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/typecheck.c b/typecheck.c index 9e94ea2f..10c5820f 100644 --- a/typecheck.c +++ b/typecheck.c @@ -49,6 +49,9 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast) if (!item_t) code_err(item_type, "I can't figure out what this type is."); if (has_stack_memory(item_t)) code_err(item_type, "Arrays can't have stack references because the array may outlive the stack frame."); + if (padded_type_size(item_t) > ARRAY_MAX_STRIDE) + code_err(ast, "This array holds items that take up %ld bytes, but the maximum supported size is %ld bytes. Consider using an array of pointers instead.", + padded_type_size(item_t), ARRAY_MAX_STRIDE); return Type(ArrayType, .item_type=item_t); } case TableTypeAST: { |
