Skip to content

Commit

Permalink
Fix state / ready bug for eval check
Browse files Browse the repository at this point in the history
  • Loading branch information
pubby committed Mar 9, 2023
1 parent e1b6ce4 commit c9618d0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ class eval_t
static constexpr bool is_compile(do_t d) { return d == COMPILE; }
static constexpr bool is_link(do_t d) { return d == INTERPRET_LINK; }

type_t const& var_type(var_ht v) const { assert(v.id < var_types.size()); return var_types[v.id]; }
type_t& var_type(var_ht v) { assert(v.id < var_types.size()); return var_types[v.id]; }
type_t const& var_type(var_ht v) const { passert(v.id < var_types.size(), v.id); return var_types[v.id]; }
type_t& var_type(var_ht v) { passert(v.id < var_types.size(), v.id); return var_types[v.id]; }

stmt_ht stmt_handle() const { return { stmt - fn->def().stmts.data() }; }
pstring_mods_t stmt_pstring_mods() const { return { stmt->pstring, fn->def().mods_of(stmt_handle()) }; }
Expand Down Expand Up @@ -4082,6 +4082,11 @@ expr_value_t eval_t::to_rval(expr_value_t v)
v.val = rval_t{ builder.cfg->emplace_ssa(SSA_ready, TYPE_BOOL) };
else if(is_interpret(D))
compiler_error(v.pstring, "Expression cannot be evaluated at compile-time.");
else
{
assert(is_check(D));
v.val = rval_t{};
}

return v;
}
Expand Down Expand Up @@ -4109,6 +4114,13 @@ expr_value_t eval_t::to_rval(expr_value_t v)
}
else if(is_interpret(D))
compiler_error(v.pstring, "Expression cannot be evaluated at compile-time.");
else
{
assert(is_check(D));
v.val = rval_t{};
}

return v;
}

if(lval->arg == lval_t::RETURN_ARG)
Expand Down

0 comments on commit c9618d0

Please sign in to comment.