pipe through parent expression string info through expr -> string generation path, so we can correctly generate standalone expression strings in the presence of $ (parent shortcuts)

This commit is contained in:
Ryan Fleury
2025-04-21 11:54:55 -07:00
parent 7946e938c0
commit 0ce9925ba6
6 changed files with 25 additions and 18 deletions
+3 -3
View File
@@ -2183,7 +2183,7 @@ rd_view_from_eval(RD_Cfg *parent, E_Eval eval)
args_count = type->count;
}
RD_Cfg *expr_root = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
rd_cfg_new_replace(expr_root, e_string_from_expr(scratch.arena, primary_expr));
rd_cfg_new_replace(expr_root, e_string_from_expr(scratch.arena, primary_expr, str8_zero()));
{
U64 unnamed_order_idx = 0;
for EachIndex(arg_idx, args_count)
@@ -2216,7 +2216,7 @@ rd_view_from_eval(RD_Cfg *parent, E_Eval eval)
unnamed_order_idx += 1;
}
RD_Cfg *arg_root = rd_cfg_child_from_string_or_alloc(view, param_name);
rd_cfg_new_replace(arg_root, e_string_from_expr(scratch.arena, arg_expr));
rd_cfg_new_replace(arg_root, e_string_from_expr(scratch.arena, arg_expr, str8_zero()));
}
}
}
@@ -4495,7 +4495,7 @@ rd_view_ui(Rng2F32 rect)
cell->eval.space.kind == E_SpaceKind_File ||
cell->eval.space.kind == E_SpaceKind_Null)
{
RD_RegsScope(.expr = e_string_from_expr(scratch.arena, cell->eval.expr))
RD_RegsScope(.expr = e_string_from_expr(scratch.arena, cell->eval.expr, e_string_from_expr(scratch.arena, row->eval.expr, str8_zero())))
rd_drag_begin(RD_RegSlot_Expr);
}
}
+2 -2
View File
@@ -1615,13 +1615,13 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
// rjf: default case -> just walk the expression tree & generate a string
default:
{
expr_string = e_string_from_expr(arena, notable_expr);
expr_string = e_string_from_expr(arena, notable_expr, str8_zero());
}break;
// rjf: array indices -> fast path to [index]
case E_ExprKind_ArrayIndex:
{
expr_string = push_str8f(arena, "[%S]", e_string_from_expr(arena, notable_expr->last));
expr_string = push_str8f(arena, "[%S]", e_string_from_expr(arena, notable_expr->last, str8_zero()));
}break;
// rjf: member accesses -> fast-path to .name