forked from lix-project/lix
fixup! s/forceValue/forceFunction/ where applicable
This commit is contained in:
parent
ed02fa3c40
commit
57684d6247
|
@ -747,14 +747,6 @@ LocalNoInlineNoReturn(void throwEvalError(const Pos & p1, const char * s, const
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s))
|
|
||||||
{
|
|
||||||
throw TypeError({
|
|
||||||
.msg = hintfmt(s),
|
|
||||||
.errPos = pos
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const ExprLambda & fun, const Symbol & s2))
|
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const ExprLambda & fun, const Symbol & s2))
|
||||||
{
|
{
|
||||||
throw TypeError({
|
throw TypeError({
|
||||||
|
@ -763,11 +755,6 @@ LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v))
|
|
||||||
//{
|
|
||||||
// throw TypeError(s, showType(v));
|
|
||||||
//}
|
|
||||||
|
|
||||||
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v))
|
LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v))
|
||||||
{
|
{
|
||||||
throw AssertionError({
|
throw AssertionError({
|
||||||
|
@ -1371,7 +1358,7 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
for (auto & i : lambda.formals->formals) {
|
for (auto & i : lambda.formals->formals) {
|
||||||
auto j = args[0]->attrs->get(i.name);
|
auto j = args[0]->attrs->get(i.name);
|
||||||
if (!j) {
|
if (!j) {
|
||||||
if (!i.def) throwTypeError(pos, "%1% called without required argument '%2%'",
|
if (!i.def) throwTypeError(pos, "Function %1% called without required argument '%2%'",
|
||||||
lambda, i.name);
|
lambda, i.name);
|
||||||
env2.values[displ++] = i.def->maybeThunk(*this, env2);
|
env2.values[displ++] = i.def->maybeThunk(*this, env2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1387,7 +1374,7 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
user. */
|
user. */
|
||||||
for (auto & i : *args[0]->attrs)
|
for (auto & i : *args[0]->attrs)
|
||||||
if (!lambda.formals->has(i.name))
|
if (!lambda.formals->has(i.name))
|
||||||
throwTypeError(pos, "%1% called with unexpected argument '%2%'", lambda, i.name);
|
throwTypeError(pos, "Function %1% called with unexpected argument '%2%'", lambda, i.name);
|
||||||
abort(); // can't happen
|
abort(); // can't happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2059,7 +2046,7 @@ Path EvalState::coerceToPath(const Pos & pos, Value & v, PathSet & context, cons
|
||||||
|
|
||||||
StorePath EvalState::coerceToStorePath(const Pos & pos, Value & v, PathSet & context, const std::string & errorCtx)
|
StorePath EvalState::coerceToStorePath(const Pos & pos, Value & v, PathSet & context, const std::string & errorCtx)
|
||||||
{
|
{
|
||||||
auto path = coerceToString(pos, v, context, false, false, errorCtx).toOwned();
|
auto path = coerceToString(pos, v, context, false, false, true, errorCtx).toOwned();
|
||||||
if (auto storePath = store->maybeParseStorePath(path))
|
if (auto storePath = store->maybeParseStorePath(path))
|
||||||
return *storePath;
|
return *storePath;
|
||||||
throw EvalError({
|
throw EvalError({
|
||||||
|
|
|
@ -683,12 +683,12 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar
|
||||||
res.push_back(e);
|
res.push_back(e);
|
||||||
|
|
||||||
/* Call the `operator' function with `e' as argument. */
|
/* Call the `operator' function with `e' as argument. */
|
||||||
Value call;
|
Value res;
|
||||||
call.mkApp(op->value, e);
|
state.callFunction(*op->value, 1, &e, res, *op->pos);
|
||||||
state.forceList(call, pos, "While evaluating the return value of the `operator` passed to builtins.genericClosure");
|
state.forceList(res, pos, "While evaluating the return value of the `operator` passed to builtins.genericClosure");
|
||||||
|
|
||||||
/* Add the values returned by the operator to the work set. */
|
/* Add the values returned by the operator to the work set. */
|
||||||
for (auto elem : call.listItems()) {
|
for (auto elem : res.listItems()) {
|
||||||
state.forceValue(*elem, pos);
|
state.forceValue(*elem, pos);
|
||||||
workSet.push_back(elem);
|
workSet.push_back(elem);
|
||||||
}
|
}
|
||||||
|
@ -2033,7 +2033,7 @@ static void prim_path(EvalState & state, const Pos & pos, Value * * args, Value
|
||||||
else if (attr.name == state.sName)
|
else if (attr.name == state.sName)
|
||||||
name = state.forceStringNoCtx(*attr.value, *attr.pos, "while evaluating the `name` attribute passed to builtins.path");
|
name = state.forceStringNoCtx(*attr.value, *attr.pos, "while evaluating the `name` attribute passed to builtins.path");
|
||||||
else if (n == "filter")
|
else if (n == "filter")
|
||||||
state.forceFunction(filterFun = *attr.value, *attr.pos, "While evaluating the `filter` parameter passed to builtins.path");
|
state.forceFunction(*(filterFun = attr.value), *attr.pos, "While evaluating the `filter` parameter passed to builtins.path");
|
||||||
else if (n == "recursive")
|
else if (n == "recursive")
|
||||||
method = FileIngestionMethod { state.forceBool(*attr.value, *attr.pos, "While evaluating the `recursive` attribute passed to builtins.path") };
|
method = FileIngestionMethod { state.forceBool(*attr.value, *attr.pos, "While evaluating the `recursive` attribute passed to builtins.path") };
|
||||||
else if (n == "sha256")
|
else if (n == "sha256")
|
||||||
|
|
Loading…
Reference in a new issue