aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-02-04 00:31:33 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-02-04 00:33:21 +0100
commitbd383d1b6f91c4fe7ac21c52771e92027f649fa0 (patch)
tree6845b5d2f709df2cbf06bca8de67cdab075902d2 /src/nix
parent4c755c3b3fc427afe192d223b37c288c88cc57d5 (diff)
Make most calls to determinePos() lazy
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/repl.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 54daeb246..e9bebff17 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -673,7 +673,7 @@ void NixRepl::reloadFiles()
void NixRepl::addAttrsToScope(Value & attrs)
{
- state->forceAttrs(attrs, attrs.determinePos(noPos));
+ state->forceAttrs(attrs, [&]() { return attrs.determinePos(noPos); });
if (displ + attrs.attrs->size() >= envSize)
throw Error("environment full; cannot add more variables");
@@ -712,7 +712,7 @@ void NixRepl::evalString(string s, Value & v)
{
Expr * e = parseString(s);
e->eval(*state, *env, v);
- state->forceValue(v, v.determinePos(noPos));
+ state->forceValue(v, [&]() { return v.determinePos(noPos); });
}
@@ -742,7 +742,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
str.flush();
checkInterrupt();
- state->forceValue(v, v.determinePos(noPos));
+ state->forceValue(v, [&]() { return v.determinePos(noPos); });
switch (v.type()) {