From c0a567e1963faaf9b16f772d6b4e76496a88ed32 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 29 Mar 2022 16:44:47 -0600 Subject: [PATCH] remove const_cast --- src/libexpr/eval.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index f162f3e0b..cc0380d4a 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -937,7 +937,7 @@ LocalNoInlineNoReturn(void throwAssertionError(const Pos & pos, const char * s, throw error; } -LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char * s, const string & s1, Env & env, Expr &expr)) +LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char * s, const string & s1, Env & env, const Expr &expr)) { auto error = UndefinedVarError({ .msg = hintfmt(s, s1), @@ -1053,8 +1053,7 @@ inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval) return j->value; } if (!env->prevWith) { - // TODO deal with const_cast - throwUndefinedVarError(var.pos, "undefined variable '%1%'", var.name, *env, *const_cast(&var)); + throwUndefinedVarError(var.pos, "undefined variable '%1%'", var.name, *env, var); } for (size_t l = env->prevWith; l; --l, env = env->up) ; }