correctly evaluate array lens size arguments in the context of the parent expression

This commit is contained in:
Ryan Fleury
2025-05-01 10:16:41 -07:00
parent aa9a00f754
commit 80268dd770
4 changed files with 11 additions and 21 deletions
+1 -1
View File
@@ -2339,7 +2339,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(array)
{
E_Type *type = e_type_from_key__cached(eval.irtree.type_key);
U64 count = 1;
if(type->args != 0 && type->count > 0)
if(type->args != 0 && type->count > 0) E_ParentKey(eval.key)
{
E_Key count_key = e_key_from_expr(type->args[0]);
E_Value count_value = e_value_from_key(count_key);
@@ -1575,8 +1575,11 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
else if(str8_match(type->name, str8_lit("hex"), 0)) { lens_params.radix = 16; }
else if(str8_match(type->name, str8_lit("digits"), 0) && type->count >= 1)
{
E_Value value = e_value_from_expr(type->args[0]);
lens_params.min_digits = value.u64;
E_ParentKey(eval.key)
{
E_Value value = e_value_from_expr(type->args[0]);
lens_params.min_digits = value.u64;
}
}
else if(str8_match(type->name, str8_lit("no_string"), 0))
{
@@ -1596,8 +1599,11 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
element_type_kind == E_TypeKind_S8 ||
element_type_kind == E_TypeKind_U8)))
{
lens_params.limit_strings = 1;
lens_params.limit_strings_size = e_value_from_expr(type->args[0]).u64;
E_ParentKey(eval.key)
{
lens_params.limit_strings = 1;
lens_params.limit_strings_size = e_value_from_expr(type->args[0]).u64;
}
}
else
{
-15
View File
@@ -9801,21 +9801,6 @@ rd_autocomp_cursor_info_from_input_string_off(Arena *arena, String8 input, U64 c
return result;
}
internal String8
rd_autocomp_query_word_from_input_string_off(String8 input, U64 cursor_off)
{
U64 word_start_off = 0;
for(U64 off = 0; off < input.size && off < cursor_off; off += 1)
{
if(!char_is_alpha(input.str[off]) && !char_is_digit(input.str[off], 10) && input.str[off] != '_')
{
word_start_off = off+1;
}
}
String8 query = str8_skip(str8_prefix(input, cursor_off), word_start_off);
return query;
}
internal void
rd_set_autocomp_regs_(RD_Regs *regs)
{
-1
View File
@@ -963,7 +963,6 @@ internal void rd_set_hover_eval(Vec2F32 pos, String8 string);
//~ rjf: Autocompletion Lister
internal RD_AutocompCursorInfo rd_autocomp_cursor_info_from_input_string_off(Arena *arena, String8 input, U64 cursor_off);
internal String8 rd_autocomp_query_word_from_input_string_off(String8 input, U64 cursor_off);
internal void rd_set_autocomp_regs_(RD_Regs *regs);
#define rd_set_autocomp_regs(...) rd_set_autocomp_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__})