Fix typo.
This commit is contained in:
parent
9416202465
commit
6468f63994
|
@ -18,7 +18,7 @@ namespace nix {
|
||||||
EvalState::EvalState()
|
EvalState::EvalState()
|
||||||
: sessionNormalForms(32768), normalForms(32768), primOps(128)
|
: sessionNormalForms(32768), normalForms(32768), primOps(128)
|
||||||
{
|
{
|
||||||
nrEvaluated = nrCached = nrDephtAfterReset = 0;
|
nrEvaluated = nrCached = nrDepthAfterReset = 0;
|
||||||
|
|
||||||
initNixExprHelpers();
|
initNixExprHelpers();
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ Expr evalExpr(EvalState & state, Expr e)
|
||||||
|
|
||||||
const unsigned int hugeEvalExpr = 100;
|
const unsigned int hugeEvalExpr = 100;
|
||||||
unsigned int nrEvaluated = state.nrEvaluated++;
|
unsigned int nrEvaluated = state.nrEvaluated++;
|
||||||
state.nrDephtAfterReset++;
|
state.nrDepthAfterReset++;
|
||||||
|
|
||||||
/* Consult the memo table to quickly get the normal form of
|
/* Consult the memo table to quickly get the normal form of
|
||||||
previously evaluated expressions. */
|
previously evaluated expressions. */
|
||||||
|
@ -843,12 +843,12 @@ Expr evalExpr(EvalState & state, Expr e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// session independent condition
|
// session independent condition
|
||||||
if (state.nrDephtAfterReset && state.safeCache &&
|
if (state.nrDepthAfterReset && state.safeCache &&
|
||||||
// heuristic condition
|
// heuristic condition
|
||||||
state.nrEvaluated - nrEvaluated > hugeEvalExpr) {
|
state.nrEvaluated - nrEvaluated > hugeEvalExpr) {
|
||||||
state.sessionNormalForms.remove(e);
|
state.sessionNormalForms.remove(e);
|
||||||
state.normalForms.set(e, nf);
|
state.normalForms.set(e, nf);
|
||||||
state.nrDephtAfterReset--;
|
state.nrDepthAfterReset--;
|
||||||
} else {
|
} else {
|
||||||
state.sessionNormalForms.set(e, nf);
|
state.sessionNormalForms.set(e, nf);
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,7 @@ Expr evalExpr(EvalState & state, Expr e)
|
||||||
Expr evalFile(EvalState & state, const Path & path)
|
Expr evalFile(EvalState & state, const Path & path)
|
||||||
{
|
{
|
||||||
startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path);
|
startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path);
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
Expr e = parseExprFromFile(state, path);
|
Expr e = parseExprFromFile(state, path);
|
||||||
try {
|
try {
|
||||||
return evalExpr(state, e);
|
return evalExpr(state, e);
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct EvalState
|
||||||
|
|
||||||
unsigned int nrEvaluated;
|
unsigned int nrEvaluated;
|
||||||
unsigned int nrCached;
|
unsigned int nrCached;
|
||||||
unsigned int nrDephtAfterReset;
|
unsigned int nrDepthAfterReset;
|
||||||
|
|
||||||
bool allowUnsafeEquality;
|
bool allowUnsafeEquality;
|
||||||
bool safeCache;
|
bool safeCache;
|
||||||
|
|
|
@ -74,14 +74,14 @@ static Expr prim_null(EvalState & state, const ATermVector & args)
|
||||||
platforms. */
|
platforms. */
|
||||||
static Expr prim_currentSystem(EvalState & state, const ATermVector & args)
|
static Expr prim_currentSystem(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
return makeStr(thisSystem);
|
return makeStr(thisSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Expr prim_currentTime(EvalState & state, const ATermVector & args)
|
static Expr prim_currentTime(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
return ATmake("Int(<int>)", time(0));
|
return ATmake("Int(<int>)", time(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ static Expr prim_addErrorContext(EvalState & state, const ATermVector & args)
|
||||||
static Expr prim_getEnv(EvalState & state, const ATermVector & args)
|
static Expr prim_getEnv(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
string name = evalStringNoCtx(state, args[0]);
|
string name = evalStringNoCtx(state, args[0]);
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
return makeStr(getEnv(name));
|
return makeStr(getEnv(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ static Hash hashDerivationModulo(EvalState & state, Derivation drv)
|
||||||
static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
startNest(nest, lvlVomit, "evaluating derivation");
|
startNest(nest, lvlVomit, "evaluating derivation");
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
|
|
||||||
ATermMap attrs;
|
ATermMap attrs;
|
||||||
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
||||||
|
@ -553,7 +553,7 @@ static Expr prim_storePath(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
PathSet context;
|
PathSet context;
|
||||||
Path path = canonPath(coerceToPath(state, args[0], context));
|
Path path = canonPath(coerceToPath(state, args[0], context));
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
if (!isInStore(path))
|
if (!isInStore(path))
|
||||||
throw EvalError(format("path `%1%' is not in the Nix store") % path);
|
throw EvalError(format("path `%1%' is not in the Nix store") % path);
|
||||||
Path path2 = toStorePath(path);
|
Path path2 = toStorePath(path);
|
||||||
|
@ -570,7 +570,7 @@ static Expr prim_pathExists(EvalState & state, const ATermVector & args)
|
||||||
Path path = coerceToPath(state, args[0], context);
|
Path path = coerceToPath(state, args[0], context);
|
||||||
if (!context.empty())
|
if (!context.empty())
|
||||||
throw EvalError(format("string `%1%' cannot refer to other paths") % path);
|
throw EvalError(format("string `%1%' cannot refer to other paths") % path);
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
return makeBool(pathExists(path));
|
return makeBool(pathExists(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ static Expr prim_readFile(EvalState & state, const ATermVector & args)
|
||||||
Path path = coerceToPath(state, args[0], context);
|
Path path = coerceToPath(state, args[0], context);
|
||||||
if (!context.empty())
|
if (!context.empty())
|
||||||
throw EvalError(format("string `%1%' cannot refer to other paths") % path);
|
throw EvalError(format("string `%1%' cannot refer to other paths") % path);
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
return makeStr(readFile(path));
|
return makeStr(readFile(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ static Expr prim_toFile(EvalState & state, const ATermVector & args)
|
||||||
refs.insert(path);
|
refs.insert(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
Path storePath = readOnlyMode
|
Path storePath = readOnlyMode
|
||||||
? computeStorePathForText(name, contents, refs)
|
? computeStorePathForText(name, contents, refs)
|
||||||
: store->addTextToStore(name, contents, refs);
|
: store->addTextToStore(name, contents, refs);
|
||||||
|
@ -697,7 +697,7 @@ static Expr prim_filterSource(EvalState & state, const ATermVector & args)
|
||||||
|
|
||||||
FilterFromExpr filter(state, args[0]);
|
FilterFromExpr filter(state, args[0]);
|
||||||
|
|
||||||
state.nrDephtAfterReset = 0;
|
state.nrDepthAfterReset = 0;
|
||||||
Path dstPath = readOnlyMode
|
Path dstPath = readOnlyMode
|
||||||
? computeStorePathForPath(path, true, htSHA256, filter).first
|
? computeStorePathForPath(path, true, htSHA256, filter).first
|
||||||
: store->addToStore(path, true, htSHA256, filter);
|
: store->addToStore(path, true, htSHA256, filter);
|
||||||
|
|
Loading…
Reference in a new issue