mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-24 06:56:14 +02:00
cleanup
This commit is contained in:
parent
885f819922
commit
7e2a3db4eb
3 changed files with 7 additions and 15 deletions
|
@ -78,8 +78,6 @@ void printValue(std::ostream & str, std::set<const Value *> & active, const Valu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str << "internal type: " << v.internalType << std::endl;
|
|
||||||
|
|
||||||
switch (v.internalType) {
|
switch (v.internalType) {
|
||||||
case tInt:
|
case tInt:
|
||||||
str << v.integer;
|
str << v.integer;
|
||||||
|
@ -1569,7 +1567,7 @@ void ExprWith::eval(EvalState & state, Env & env, Value & v)
|
||||||
env2.prevWith = prevWith;
|
env2.prevWith = prevWith;
|
||||||
env2.type = Env::HasWithExpr;
|
env2.type = Env::HasWithExpr;
|
||||||
env2.values[0] = (Value *) attrs;
|
env2.values[0] = (Value *) attrs;
|
||||||
|
|
||||||
body->eval(state, env2, v);
|
body->eval(state, env2, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1737,8 +1735,6 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
|
||||||
nf = n;
|
nf = n;
|
||||||
nf += vTmp.fpoint;
|
nf += vTmp.fpoint;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "envtype: " << showType(env.values[0]->type()) << std::endl;
|
|
||||||
|
|
||||||
throwEvalError(pos, "cannot add %1% to an integer", showType(vTmp), env, this);
|
throwEvalError(pos, "cannot add %1% to an integer", showType(vTmp), env, this);
|
||||||
}
|
}
|
||||||
} else if (firstType == nFloat) {
|
} else if (firstType == nFloat) {
|
||||||
|
@ -1829,7 +1825,7 @@ bool EvalState::forceBool(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v, pos);
|
forceValue(v, pos);
|
||||||
if (v.type() != nBool)
|
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);
|
fakeEnv(1), 0);
|
||||||
return v.boolean;
|
return v.boolean;
|
||||||
}
|
}
|
||||||
|
@ -1906,12 +1902,10 @@ string EvalState::forceStringNoCtx(Value & v, const Pos & pos)
|
||||||
if (v.string.context) {
|
if (v.string.context) {
|
||||||
if (pos)
|
if (pos)
|
||||||
throwEvalError(pos, "the string '%1%' is not allowed to refer to a store path (such as '%2%')",
|
throwEvalError(pos, "the string '%1%' is not allowed to refer to a store path (such as '%2%')",
|
||||||
v.string.s, v.string.context[0],
|
v.string.s, v.string.context[0], fakeEnv(1), 0);
|
||||||
fakeEnv(1), 0);
|
|
||||||
else
|
else
|
||||||
throwEvalError("the string '%1%' is not allowed to refer to a store path (such as '%2%')",
|
throwEvalError("the string '%1%' is not allowed to refer to a store path (such as '%2%')",
|
||||||
v.string.s, v.string.context[0],
|
v.string.s, v.string.context[0], fakeEnv(1), 0);
|
||||||
fakeEnv(1), 0);
|
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -1965,7 +1959,7 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context,
|
||||||
}
|
}
|
||||||
auto i = v.attrs->find(sOutPath);
|
auto i = v.attrs->find(sOutPath);
|
||||||
if (i == v.attrs->end())
|
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);
|
fakeEnv(1), 0);
|
||||||
return coerceToString(pos, *i->value, context, coerceMore, copyToStore);
|
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);
|
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);
|
string path = coerceToString(pos, v, context, false, false);
|
||||||
if (path == "" || path[0] != '/')
|
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);
|
fakeEnv(1), 0);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,6 @@ public:
|
||||||
string forceString(Value & v, const Pos & pos = noPos);
|
string forceString(Value & v, const Pos & pos = noPos);
|
||||||
string forceString(Value & v, PathSet & context, const Pos & pos = noPos);
|
string forceString(Value & v, PathSet & context, const Pos & pos = noPos);
|
||||||
string forceStringNoCtx(Value & v, const Pos & pos = noPos);
|
string forceStringNoCtx(Value & v, const Pos & pos = noPos);
|
||||||
// string forceStringNoCtx(std::optional<Bindings*> b, Value & v, const Pos & pos = noPos);
|
|
||||||
|
|
||||||
/* Return true iff the value `v' denotes a derivation (i.e. a
|
/* Return true iff the value `v' denotes a derivation (i.e. a
|
||||||
set with attribute `type = "derivation"'). */
|
set with attribute `type = "derivation"'). */
|
||||||
|
|
|
@ -295,7 +295,6 @@ void ExprVar::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
"undefined variable" error now. */
|
"undefined variable" error now. */
|
||||||
if (withLevel == -1)
|
if (withLevel == -1)
|
||||||
{
|
{
|
||||||
// std::cout << " throw UndefinedVarError({" << std::endl;
|
|
||||||
throw UndefinedVarError({
|
throw UndefinedVarError({
|
||||||
.msg = hintfmt("undefined variable (ExprVar bindvars) '%1%'", name),
|
.msg = hintfmt("undefined variable (ExprVar bindvars) '%1%'", name),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
|
|
Loading…
Reference in a new issue