mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 18:12:23 -07:00
correctly treat chains of lenses when looking up type hooks; allow type-evaluations when producing per-cell evaluations
This commit is contained in:
+27
-6
@@ -946,6 +946,16 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
// rjf: pick access hook based on type
|
||||
E_Type *lhs_type = e_type_from_key__cached(lhs_irtree_try->type_key);
|
||||
E_TypeAccessFunctionType *lhs_access = lhs_type->access;
|
||||
for(E_Type *lens_type = lhs_type;
|
||||
lens_type->kind == E_TypeKind_Lens || lens_type->kind == E_TypeKind_Set;
|
||||
lens_type = e_type_from_key__cached(lens_type->direct_type_key))
|
||||
{
|
||||
if(lens_type->access != 0)
|
||||
{
|
||||
lhs_access = lens_type->access;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(lhs_access == 0)
|
||||
{
|
||||
lhs_access = E_TYPE_ACCESS_FUNCTION_NAME(default);
|
||||
@@ -2302,15 +2312,26 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
//- rjf: if the evaluated type has a hook for an extra layer of ir extension,
|
||||
// call into it
|
||||
E_Type *type = e_type_from_key__cached(result.type_key);
|
||||
if(type->kind != E_TypeKind_LensSpec && type->irext != 0)
|
||||
{
|
||||
E_IRTreeAndType irtree_stripped = result;
|
||||
if(type->kind == E_TypeKind_Lens)
|
||||
E_TypeIRExtFunctionType *irext = type->irext;
|
||||
for(E_Type *t = type; t->kind == E_TypeKind_Lens || t->kind == E_TypeKind_Set; t = e_type_from_key__cached(t->direct_type_key))
|
||||
{
|
||||
irtree_stripped.type_key = e_type_key_direct(irtree_stripped.type_key);
|
||||
if(t->irext != 0)
|
||||
{
|
||||
irext = t->irext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(irext != 0)
|
||||
{
|
||||
E_IRTreeAndType irtree_stripped = result;
|
||||
if(type->kind == E_TypeKind_Lens)
|
||||
{
|
||||
irtree_stripped.type_key = e_type_key_direct(irtree_stripped.type_key);
|
||||
}
|
||||
E_IRExt ext = irext(arena, expr, &irtree_stripped);
|
||||
result.user_data = ext.user_data;
|
||||
}
|
||||
E_IRExt ext = type->irext(arena, expr, &irtree_stripped);
|
||||
result.user_data = ext.user_data;
|
||||
}
|
||||
|
||||
//- rjf: equip previous task's irtree
|
||||
|
||||
@@ -562,6 +562,16 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, E_Expr *exp
|
||||
{
|
||||
type_expand_rule = &type->expand;
|
||||
}
|
||||
for(E_Type *lens_type = type;
|
||||
lens_type->kind == E_TypeKind_Lens || lens_type->kind == E_TypeKind_Set;
|
||||
lens_type = e_type_from_key__cached(lens_type->direct_type_key))
|
||||
{
|
||||
if(lens_type->expand.info != 0)
|
||||
{
|
||||
type_expand_rule = &lens_type->expand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: get eval's visualization expansion rule
|
||||
EV_ExpandRule *viz_expand_rule = ev_expand_rule_from_type_key(type_key);
|
||||
|
||||
@@ -1404,7 +1404,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
{
|
||||
result.flags |= RD_WatchCellFlag_CanEdit;
|
||||
}
|
||||
result.eval = (cell->eval.irtree.mode != E_Mode_Null ? cell->eval : row->eval);
|
||||
result.eval = (!e_type_key_match(cell->eval.irtree.type_key, e_type_key_zero()) ? cell->eval : row->eval);
|
||||
result.string = row->string;
|
||||
if(result.string.size == 0)
|
||||
{
|
||||
@@ -1525,7 +1525,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
}
|
||||
|
||||
//- rjf: evaluate wrapped expression
|
||||
result.eval = (cell->eval.irtree.mode != E_Mode_Null ? cell->eval : e_eval_from_expr(arena, root_expr));
|
||||
result.eval = (!e_type_key_match(cell->eval.irtree.type_key, e_type_key_zero()) ? cell->eval : e_eval_from_expr(arena, root_expr));
|
||||
|
||||
//- rjf: determine string generation parameters based on evaluation
|
||||
EV_StringParams string_params = {string_flags, 10};
|
||||
|
||||
Reference in New Issue
Block a user