mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-25 13:05:00 -07:00
make eval ctxs more robust to missing info, e.g. in the test harness case
This commit is contained in:
+1
-1
@@ -125,7 +125,7 @@ E_ExprKindTable:
|
||||
{ LeafU64 Null 0 "U64" "" "" "" }
|
||||
{ LeafF64 Null 0 "F64" "" "" "" }
|
||||
{ LeafF32 Null 0 "F32" "" "" "" }
|
||||
{ LeafIdent Null 0 "leaf_ident" "" "" "" }
|
||||
{ LeafIdentifier Null 0 "leaf_identifier" "" "" "" }
|
||||
{ LeafOffset Null 0 "leaf_offset" "" "" "" }
|
||||
{ LeafValue Null 0 "leaf_value" "" "" "" }
|
||||
{ LeafFilePath Null 0 "leaf_filepath" "" "" "" }
|
||||
|
||||
@@ -142,6 +142,11 @@ struct E_Module
|
||||
|
||||
#include "eval/generated/eval.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
global read_only E_Module e_module_nil = {&rdi_parsed_nil};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helper Functions
|
||||
|
||||
|
||||
+4
-3
@@ -75,6 +75,7 @@ e_select_ir_ctx(E_IRCtx *ctx)
|
||||
e_ir_state->arena_eval_start_pos = arena_pos(arena);
|
||||
}
|
||||
arena_pop_to(e_ir_state->arena, e_ir_state->arena_eval_start_pos);
|
||||
if(ctx->macro_map == 0) {ctx->macro_map = &e_string2expr_map_nil;}
|
||||
e_ir_state->ctx = ctx;
|
||||
e_ir_state->used_tag_map = push_array(e_ir_state->arena, E_UsedTagMap, 1);
|
||||
e_ir_state->used_tag_map->slots_count = 64;
|
||||
@@ -1230,7 +1231,7 @@ E_IRGEN_FUNCTION_DEF(wrap)
|
||||
Task *last_task = first_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
if(t->expr->kind == E_ExprKind_LeafIdent && str8_match(t->expr->string, str8_lit("$expr"), 0))
|
||||
if(t->expr->kind == E_ExprKind_LeafIdentifier && str8_match(t->expr->string, str8_lit("$expr"), 0))
|
||||
{
|
||||
E_Expr *original_expr_ref = e_expr_ref(arena, expr);
|
||||
if(t->parent != &e_expr_nil)
|
||||
@@ -2530,7 +2531,7 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
}break;
|
||||
|
||||
//- rjf: leaf identifiers
|
||||
case E_ExprKind_LeafIdent:
|
||||
case E_ExprKind_LeafIdentifier:
|
||||
{
|
||||
E_Expr *macro_expr = e_string2expr_lookup(e_ir_state->ctx->macro_map, expr->string);
|
||||
if(macro_expr == &e_expr_nil)
|
||||
@@ -2618,7 +2619,7 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
E_Expr *lhs = expr->first;
|
||||
E_Expr *rhs = lhs->next;
|
||||
result = e_irtree_and_type_from_expr(arena, rhs);
|
||||
if(lhs->kind != E_ExprKind_LeafIdent)
|
||||
if(lhs->kind != E_ExprKind_LeafIdentifier)
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, expr->location, "Left side of assignment must be an unused identifier.");
|
||||
}
|
||||
|
||||
@@ -637,6 +637,7 @@ e_select_parse_ctx(E_ParseCtx *ctx)
|
||||
if(ctx->reg_alias_map == 0) { ctx->reg_alias_map = &e_string2num_map_nil; }
|
||||
if(ctx->locals_map == 0) { ctx->locals_map = &e_string2num_map_nil; }
|
||||
if(ctx->member_map == 0) { ctx->member_map = &e_string2num_map_nil; }
|
||||
if(ctx->primary_module == 0){ ctx->primary_module = &e_module_nil; }
|
||||
e_parse_state->ctx = ctx;
|
||||
}
|
||||
|
||||
@@ -855,7 +856,7 @@ e_append_strings_from_expr(Arena *arena, E_Expr *expr, String8List *out)
|
||||
}break;
|
||||
case E_ExprKind_LeafBytecode:
|
||||
case E_ExprKind_LeafMember:
|
||||
case E_ExprKind_LeafIdent:
|
||||
case E_ExprKind_LeafIdentifier:
|
||||
{
|
||||
str8_list_push(arena, out, expr->string);
|
||||
}break;
|
||||
@@ -1058,7 +1059,7 @@ e_push_leaf_ident_exprs_from_expr__in_place(Arena *arena, E_String2ExprMap *map,
|
||||
{
|
||||
E_Expr *exprl = expr->first;
|
||||
E_Expr *exprr = exprl->next;
|
||||
if(exprl->kind == E_ExprKind_LeafIdent)
|
||||
if(exprl->kind == E_ExprKind_LeafIdentifier)
|
||||
{
|
||||
e_string2expr_map_insert(arena, map, exprl->string, exprr);
|
||||
}
|
||||
@@ -1869,7 +1870,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
//- rjf: map failure -> attach as leaf identifier, to be resolved later
|
||||
if(!mapped_identifier)
|
||||
{
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafIdent, token_string.str);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafIdentifier, token_string.str);
|
||||
atom->string = token_string;
|
||||
it += 1;
|
||||
}
|
||||
|
||||
@@ -241,6 +241,7 @@ e_select_type_ctx(E_TypeCtx *ctx)
|
||||
e_type_state->arena = arena;
|
||||
e_type_state->arena_eval_start_pos = arena_pos(e_type_state->arena);
|
||||
}
|
||||
if(ctx->primary_module == 0) {ctx->primary_module = &e_module_nil;}
|
||||
arena_pop_to(e_type_state->arena, e_type_state->arena_eval_start_pos);
|
||||
e_type_state->ctx = ctx;
|
||||
e_type_state->cons_id_gen = 0;
|
||||
|
||||
@@ -57,7 +57,7 @@ str8_lit_comp("LeafBool"),
|
||||
str8_lit_comp("LeafU64"),
|
||||
str8_lit_comp("LeafF64"),
|
||||
str8_lit_comp("LeafF32"),
|
||||
str8_lit_comp("LeafIdent"),
|
||||
str8_lit_comp("LeafIdentifier"),
|
||||
str8_lit_comp("LeafOffset"),
|
||||
str8_lit_comp("LeafValue"),
|
||||
str8_lit_comp("LeafFilePath"),
|
||||
|
||||
@@ -132,7 +132,7 @@ E_ExprKind_LeafBool,
|
||||
E_ExprKind_LeafU64,
|
||||
E_ExprKind_LeafF64,
|
||||
E_ExprKind_LeafF32,
|
||||
E_ExprKind_LeafIdent,
|
||||
E_ExprKind_LeafIdentifier,
|
||||
E_ExprKind_LeafOffset,
|
||||
E_ExprKind_LeafValue,
|
||||
E_ExprKind_LeafFilePath,
|
||||
|
||||
Reference in New Issue
Block a user