Skip to content

Commit 60667e9

Browse files
authored
Merge pull request #14525 from NixOS/reset-positions-repl
libexpr: Clear PosTable contents in EvalState::resetFileCache
2 parents 6ebaba5 + a091a81 commit 60667e9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/libexpr/eval.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ void EvalState::resetFileCache()
11131113
importResolutionCache->clear();
11141114
fileEvalCache->clear();
11151115
inputCache->clear();
1116+
positions.clear();
11161117
}
11171118

11181119
void EvalState::eval(Expr * e, Value & v)

src/libutil/include/nix/util/pos-table.hh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ public:
111111
return o->origin;
112112
return std::monostate{};
113113
}
114+
115+
/**
116+
* Remove all origins from the table.
117+
*/
118+
void clear()
119+
{
120+
auto lines = linesCache.lock();
121+
lines->clear();
122+
origins.clear();
123+
}
114124
};
115125

116126
} // namespace nix

0 commit comments

Comments
 (0)