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 e965ea476e
commit fff1fbe6aa

View file

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