mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-23 04:04:59 -07:00
use 'sufficient suffixes' when generating enum expansions
This commit is contained in:
+10
-1
@@ -2202,7 +2202,16 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(default)
|
||||
{
|
||||
U64 member_idx = idx + read_range.min;
|
||||
String8 member_name = type->enum_vals[member_idx].name;
|
||||
evals_out[idx] = e_eval_wrapf(eval, "$.%S", member_name);
|
||||
String8 sufficient_suffix = member_name;
|
||||
if(str8_match(sufficient_suffix, type->name, StringMatchFlag_RightSideSloppy))
|
||||
{
|
||||
sufficient_suffix = str8_skip(sufficient_suffix, type->name.size);
|
||||
if(str8_match(sufficient_suffix, str8_lit("_"), StringMatchFlag_RightSideSloppy))
|
||||
{
|
||||
sufficient_suffix = str8_skip(sufficient_suffix, 1);
|
||||
}
|
||||
}
|
||||
evals_out[idx] = e_eval_wrapf(eval, "$.%S", sufficient_suffix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1416,44 +1416,6 @@ ev_string_from_simple_typed_eval(Arena *arena, EV_StringParams *params, E_Eval e
|
||||
case E_TypeKind_LRef:{result = push_str8f(arena, "0x%I64x", eval.value.u64);}break;
|
||||
case E_TypeKind_RRef:{result = push_str8f(arena, "0x%I64x", eval.value.u64);}break;
|
||||
case E_TypeKind_Function:{result = push_str8f(arena, "0x%I64x", eval.value.u64);}break;
|
||||
|
||||
#if 0
|
||||
case E_TypeKind_Enum:
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_Type *type = e_type_from_key(type_key);
|
||||
String8 constant_name = {0};
|
||||
for(U64 val_idx = 0; val_idx < type->count; val_idx += 1)
|
||||
{
|
||||
if(eval.value.u64 == type->enum_vals[val_idx].val)
|
||||
{
|
||||
constant_name = type->enum_vals[val_idx].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String8 numeric_value_string = str8_from_u64(scratch.arena, eval.value.u64, params->radix, params->min_digits, digit_group_separator);
|
||||
if(params->flags & EV_StringFlag_ReadOnlyDisplayRules)
|
||||
{
|
||||
if(constant_name.size != 0)
|
||||
{
|
||||
result = push_str8f(arena, "%S (%S)", numeric_value_string, constant_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = push_str8_copy(arena, numeric_value_string);
|
||||
}
|
||||
}
|
||||
else if(constant_name.size != 0)
|
||||
{
|
||||
result = push_str8_copy(arena, constant_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = push_str8_copy(arena, numeric_value_string);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -9823,10 +9823,6 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
|
||||
MemoryZeroStruct(&list_expr);
|
||||
}
|
||||
}
|
||||
else if(e_type_kind_from_key(maybe_enum_type) == E_TypeKind_Enum)
|
||||
{
|
||||
list_expr = e_type_string_from_key(scratch.arena, maybe_enum_type);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: determine if autocompletion lister is allowed
|
||||
|
||||
Reference in New Issue
Block a user