From 7e2a3db4eb663aa99aec7ebcc83d75cb948a2cb3 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 9 Nov 2021 13:14:49 -0700 Subject: [PATCH] cleanup --- src/libexpr/eval.cc | 20 +++++++------------- src/libexpr/eval.hh | 1 - src/libexpr/nixexpr.cc | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 32d51ab87..8e263334a 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -78,8 +78,6 @@ void printValue(std::ostream & str, std::set & active, const Valu return; } - str << "internal type: " << v.internalType << std::endl; - switch (v.internalType) { case tInt: str << v.integer; @@ -1569,7 +1567,7 @@ void ExprWith::eval(EvalState & state, Env & env, Value & v) env2.prevWith = prevWith; env2.type = Env::HasWithExpr; env2.values[0] = (Value *) attrs; - + body->eval(state, env2, v); } @@ -1737,8 +1735,6 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v) nf = n; nf += vTmp.fpoint; } else { - std::cerr << "envtype: " << showType(env.values[0]->type()) << std::endl; - throwEvalError(pos, "cannot add %1% to an integer", showType(vTmp), env, this); } } else if (firstType == nFloat) { @@ -1829,7 +1825,7 @@ bool EvalState::forceBool(Value & v, const Pos & pos) { forceValue(v, pos); if (v.type() != nBool) - throwTypeError(pos, "value is %1% while a Boolean was expected", v, + throwTypeError(pos, "value is %1% while a Boolean was expected", v, fakeEnv(1), 0); return v.boolean; } @@ -1906,12 +1902,10 @@ string EvalState::forceStringNoCtx(Value & v, const Pos & pos) if (v.string.context) { if (pos) throwEvalError(pos, "the string '%1%' is not allowed to refer to a store path (such as '%2%')", - v.string.s, v.string.context[0], - fakeEnv(1), 0); + v.string.s, v.string.context[0], fakeEnv(1), 0); else throwEvalError("the string '%1%' is not allowed to refer to a store path (such as '%2%')", - v.string.s, v.string.context[0], - fakeEnv(1), 0); + v.string.s, v.string.context[0], fakeEnv(1), 0); } return s; } @@ -1965,7 +1959,7 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context, } auto i = v.attrs->find(sOutPath); if (i == v.attrs->end()) - throwTypeError(pos, "cannot coerce a set to a string", + throwTypeError(pos, "cannot coerce a set to a string", fakeEnv(1), 0); return coerceToString(pos, *i->value, context, coerceMore, copyToStore); } @@ -1996,7 +1990,7 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context, } } - throwTypeError(pos, "cannot coerce %1% to a string", v, + throwTypeError(pos, "cannot coerce %1% to a string", v, fakeEnv(1), 0); } @@ -2030,7 +2024,7 @@ Path EvalState::coerceToPath(const Pos & pos, Value & v, PathSet & context) { string path = coerceToString(pos, v, context, false, false); if (path == "" || path[0] != '/') - throwEvalError(pos, "string '%1%' doesn't represent an absolute path", path, + throwEvalError(pos, "string '%1%' doesn't represent an absolute path", path, fakeEnv(1), 0); return path; } diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index ae1e6ee60..91e43ddfe 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -208,7 +208,6 @@ public: string forceString(Value & v, const Pos & pos = noPos); string forceString(Value & v, PathSet & context, const Pos & pos = noPos); string forceStringNoCtx(Value & v, const Pos & pos = noPos); - // string forceStringNoCtx(std::optional b, Value & v, const Pos & pos = noPos); /* Return true iff the value `v' denotes a derivation (i.e. a set with attribute `type = "derivation"'). */ diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 65c7cac1d..9ccecca55 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -295,7 +295,6 @@ void ExprVar::bindVars(const std::shared_ptr &env) "undefined variable" error now. */ if (withLevel == -1) { - // std::cout << " throw UndefinedVarError({" << std::endl; throw UndefinedVarError({ .msg = hintfmt("undefined variable (ExprVar bindvars) '%1%'", name), .errPos = pos