forked from lix-project/lix
minor cleanup
This commit is contained in:
parent
a86c2a8481
commit
27d45f9eb3
|
@ -547,8 +547,6 @@ bool NixRepl::processLine(std::string line)
|
||||||
loadDebugTraceEnv(*iter);
|
loadDebugTraceEnv(*iter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
|
||||||
// showDebugTrace(std::cout, *iter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (arg == "step") {
|
else if (arg == "step") {
|
||||||
|
|
|
@ -789,6 +789,7 @@ void mapStaticEnvBindings(const StaticEnv &se, const Env &env, valmap & vm)
|
||||||
auto map = valmap();
|
auto map = valmap();
|
||||||
if (env.type == Env::HasWithAttrs)
|
if (env.type == Env::HasWithAttrs)
|
||||||
{
|
{
|
||||||
|
// add 'with' bindings.
|
||||||
Bindings::iterator j = env.values[0]->attrs->begin();
|
Bindings::iterator j = env.values[0]->attrs->begin();
|
||||||
while (j != env.values[0]->attrs->end()) {
|
while (j != env.values[0]->attrs->end()) {
|
||||||
map[j->name] = j->value;
|
map[j->name] = j->value;
|
||||||
|
@ -2123,8 +2124,7 @@ NixFloat EvalState::forceFloat(Value & v, const Pos & pos)
|
||||||
if (v.type() == nInt)
|
if (v.type() == nInt)
|
||||||
return v.integer;
|
return v.integer;
|
||||||
else if (v.type() != nFloat)
|
else if (v.type() != nFloat)
|
||||||
throwTypeError(pos, "value is %1% while a float was expected", v,
|
throwTypeError(pos, "value is %1% while a float was expected", v, *this);
|
||||||
*this);
|
|
||||||
return v.fpoint;
|
return v.fpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2133,8 +2133,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, *this);
|
||||||
*this);
|
|
||||||
return v.boolean;
|
return v.boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2149,8 +2148,7 @@ void EvalState::forceFunction(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v, pos);
|
forceValue(v, pos);
|
||||||
if (v.type() != nFunction && !isFunctor(v))
|
if (v.type() != nFunction && !isFunctor(v))
|
||||||
throwTypeError(pos, "value is %1% while a function was expected", v,
|
throwTypeError(pos, "value is %1% while a function was expected", v, *this);
|
||||||
*this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2158,8 +2156,7 @@ std::string_view EvalState::forceString(Value & v, const Pos & pos)
|
||||||
{
|
{
|
||||||
forceValue(v, pos);
|
forceValue(v, pos);
|
||||||
if (v.type() != nString) {
|
if (v.type() != nString) {
|
||||||
throwTypeError(pos, "value is %1% while a string was expected", v,
|
throwTypeError(pos, "value is %1% while a string was expected", v, *this);
|
||||||
*this);
|
|
||||||
}
|
}
|
||||||
return v.string.s;
|
return v.string.s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "nixexpr.hh"
|
#include "nixexpr.hh"
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,8 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
|
||||||
expectedHash = newHashAllowEmpty(state.forceStringNoCtx(*attr.value, *attr.pos), htSHA256);
|
expectedHash = newHashAllowEmpty(state.forceStringNoCtx(*attr.value, *attr.pos), htSHA256);
|
||||||
else if (n == "name")
|
else if (n == "name")
|
||||||
name = state.forceStringNoCtx(*attr.value, *attr.pos);
|
name = state.forceStringNoCtx(*attr.value, *attr.pos);
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
auto e = EvalError({
|
auto e = EvalError({
|
||||||
.msg = hintfmt("unsupported argument '%s' to '%s'", attr.name, who),
|
.msg = hintfmt("unsupported argument '%s' to '%s'", attr.name, who),
|
||||||
.errPos = *attr.pos
|
.errPos = *attr.pos
|
||||||
|
|
Loading…
Reference in a new issue