only decorate debug-info-table-generated expressions with `s when we can detect it is necessary (.s are now allowed); only generate simplified expression extension strings for expressions in watch windows if parent keys are present, otherwise just do the full expression

This commit is contained in:
Ryan Fleury
2025-05-08 14:14:30 -07:00
parent b30e928501
commit 2a3c5527e0
2 changed files with 19 additions and 5 deletions
+13 -2
View File
@@ -1661,8 +1661,19 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
// rjf: build a valid expression string given item string
String8 item_expr = item_string;
{
E_TokenArray tokens = e_token_array_from_text(scratch.arena, item_expr);
if(tokens.count != 1)
B32 string_can_be_evalled = 1;
E_TokenArray tokens = e_token_array_from_text(scratch.arena, item_string);
for EachIndex(idx, tokens.count)
{
String8 token_string = str8_substr(item_string, tokens.v[idx].range);
if(tokens.v[idx].kind != E_TokenKind_Identifier &&
!str8_match(token_string, str8_lit("."), 0))
{
string_can_be_evalled = 0;
break;
}
}
if(!string_can_be_evalled)
{
item_expr = push_str8f(scratch.arena, "`%S`", item_string);
}
+6 -3
View File
@@ -1716,8 +1716,11 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
expr_string = cell->eval.string;
// rjf: try to form a simpler expression string out of the expression tree itself, *if* this
// is not an editable expression, and if this evaluation was successful
if(!(block_type->flags & E_TypeFlag_EditableChildren) && cell->eval.msgs.max_kind == E_MsgKind_Null)
// is not an editable expression, and if this evaluation was successful, and if this evaluation
// has a parent
if(!e_key_match(cell->eval.parent_key, e_key_zero()) &&
!(block_type->flags & E_TypeFlag_EditableChildren) &&
cell->eval.msgs.max_kind == E_MsgKind_Null)
{
// rjf: first, locate a notable expression - we special-case things like member accesses
// or array indices, so we should grab those if possible
@@ -1740,7 +1743,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
}
}
// rjf: generate expression string based on our notable expression
// rjf: generate expression extension string based on our notable expression
switch(notable_expr->kind)
{
// rjf: default case -> just take whatever string was directly passed via the evaluation