libexpr: unbreak PosTable performance

this was mostly an inconvenience for error reporting, but fully broke
the debugger (because the debugger does *a lot* of eager position
resolution). copying the line offsets into a local and filling that
local when empty without also storing the calculated offsets back does
kind of ... not cache anything.

fixes lix-project/lix#165

Change-Id: Iccb0ba193ce2f15c832978daecf7b9bebbbe8585
This commit is contained in:
eldritch horrors 2024-03-20 13:45:36 +01:00
parent 5a28d70d1e
commit 22e3f0e987

View file

@ -593,7 +593,7 @@ Pos PosTable::operator[](PosIdx p) const
Pos result{0, 0, origin->origin};
auto lines = this->lines.lock();
auto linesForInput = (*lines)[origin->offset];
auto & linesForInput = (*lines)[origin->offset];
if (linesForInput.empty()) {
auto source = result.getSource().value_or("");