mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 15:42:23 -07:00
eval identifier resolution: allow implicitly mapping leaf identifiers to member accesses of overridden irtree
This commit is contained in:
+29
-14
@@ -1727,6 +1727,9 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
E_TypeKey mapped_type_key = zero_struct;
|
||||
E_Module *mapped_location_block_module = &e_module_nil;
|
||||
RDI_LocationBlock *mapped_location_block = 0;
|
||||
E_Mode mapped_bytecode_mode = E_Mode_Offset;
|
||||
E_Space mapped_bytecode_space = zero_struct;
|
||||
String8 mapped_bytecode = {0};
|
||||
|
||||
//- rjf: form namespaceified fallback versions of this lookup string
|
||||
String8List namespaceified_strings = {0};
|
||||
@@ -1754,6 +1757,32 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try to map name as overridden expression signifier ('$')
|
||||
if(!string_mapped && str8_match(string, str8_lit("$"), 0) && e_ir_state->overridden_irtree != 0)
|
||||
{
|
||||
E_OpList oplist = e_oplist_from_irtree(arena, e_ir_state->overridden_irtree->root);
|
||||
string_mapped = 1;
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = e_ir_state->overridden_irtree->mode;
|
||||
mapped_type_key = e_ir_state->overridden_irtree->type_key;
|
||||
allow_autohooks = 0;
|
||||
}
|
||||
|
||||
//- rjf: try to map name as implicit access of overridden expression ('$.member_name', where the $. prefix is omitted)
|
||||
if(!string_mapped && e_ir_state->overridden_irtree != 0)
|
||||
{
|
||||
E_Expr *access = e_expr_irext_member_access(scratch.arena, &e_expr_nil, e_ir_state->overridden_irtree, string);
|
||||
E_IRTreeAndType access_irtree = e_irtree_and_type_from_expr(scratch.arena, access);
|
||||
if(access_irtree.root != &e_irnode_nil)
|
||||
{
|
||||
string_mapped = 1;
|
||||
E_OpList oplist = e_oplist_from_irtree(scratch.arena, access_irtree.root);
|
||||
mapped_type_key = access_irtree.type_key;
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = access_irtree.mode;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try to map name as member - if found, string__redirected := "this", and turn
|
||||
// on later implicit-member-lookup generation
|
||||
B32 string_is_implicit_member_name = 0;
|
||||
@@ -1806,9 +1835,6 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
}
|
||||
|
||||
//- rjf: mapped to location block -> extract or produce bytecode for this mapping
|
||||
E_Mode mapped_bytecode_mode = E_Mode_Offset;
|
||||
E_Space mapped_bytecode_space = zero_struct;
|
||||
String8 mapped_bytecode = {0};
|
||||
if(mapped_location_block != 0)
|
||||
{
|
||||
E_Module *module = mapped_location_block_module;
|
||||
@@ -1900,17 +1926,6 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try to map name as overridden expression signifier ('$')
|
||||
if(!string_mapped && str8_match(string, str8_lit("$"), 0) && e_ir_state->overridden_irtree != 0)
|
||||
{
|
||||
E_OpList oplist = e_oplist_from_irtree(arena, e_ir_state->overridden_irtree->root);
|
||||
string_mapped = 1;
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = e_ir_state->overridden_irtree->mode;
|
||||
mapped_type_key = e_ir_state->overridden_irtree->type_key;
|
||||
allow_autohooks = 0;
|
||||
}
|
||||
|
||||
//- rjf: try globals
|
||||
if(!string_mapped && (qualifier.size == 0 || str8_match(qualifier, str8_lit("global"), 0)))
|
||||
{
|
||||
|
||||
@@ -1649,6 +1649,16 @@ fancy_viz_eval_tests(void)
|
||||
(void)error_code;
|
||||
#endif
|
||||
|
||||
//- rjf: booleans (checkboxes)
|
||||
bool bool1 = 0; raddbg_pin(bool1);
|
||||
bool bool2 = 1; raddbg_pin(bool2);
|
||||
bool bool3 = 0; raddbg_pin(bool3);
|
||||
|
||||
//- rjf: sliders
|
||||
float slide1 = 500.f; raddbg_pin(range1(slide1, 0, 1000));
|
||||
double slide2 = 0.75; raddbg_pin(range1(slide2, 0, 1.0));
|
||||
int slide3 = 25; raddbg_pin(range1(slide3, 0, 100));
|
||||
|
||||
//- rjf: colors
|
||||
float example_color_4f32[4] = {1.00f, 0.85f, 0.25f, 1.00f};
|
||||
unsigned int example_color_u32 = 0xff6f30ff;
|
||||
|
||||
@@ -12260,6 +12260,7 @@ rd_frame(void)
|
||||
{str8_lit("digits"), 1, 1, 0, 0, 0, {0}},
|
||||
{str8_lit("no_string"), 1, 1, 0, 0, 0, {0}},
|
||||
{str8_lit("no_addr"), 1, 1, 0, 0, 0, {0}},
|
||||
{str8_lit("range1"), 0, 0, 0, 0, 0, {0}},
|
||||
{str8_lit("slice"), 0, 0, 1, E_TYPE_IREXT_FUNCTION_NAME(slice), E_TYPE_ACCESS_FUNCTION_NAME(slice), {E_TYPE_EXPAND_INFO_FUNCTION_NAME(slice), E_TYPE_EXPAND_RANGE_FUNCTION_NAME(slice)}},
|
||||
{str8_lit("text"), 0, 0, 0, 0, 0, {0}, RD_VIEW_UI_FUNCTION_NAME(text), EV_EXPAND_RULE_INFO_FUNCTION_NAME(text)},
|
||||
{str8_lit("disasm"), 0, 0, 0, 0, 0, {0}, RD_VIEW_UI_FUNCTION_NAME(disasm), EV_EXPAND_RULE_INFO_FUNCTION_NAME(disasm)},
|
||||
|
||||
Reference in New Issue
Block a user