authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-23 21:15:07+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-26 18:21:21+01:00
logfaab901eb59a94735eec603ed42cb90b4477d8fb
tree65afebf0f69462e345d56cf1fdc489fa17461518
parent2ce057addfa2d53434f9dfa58bf4c62d2b6a308e
signature Commit is signed but in an unrecognized format.

MappedFile: fix `Node.Index.hasMoved`

Before, this would always report `false` for nodes with `bubbles_moved` set to `false`, but that is incorrect behavior; `bubbles_moved` is only relevant when considering *parent* nodes.

1 files changed, 6 insertions(+), 6 deletions(-)

src/link/MappedFile.zig+6-6
...@@ -495,12 +495,12 @@ pub const Node = extern struct {...@@ -495,12 +495,12 @@ pub const Node = extern struct {
495 }495 }
496496
497 pub fn hasMoved(ni: Node.Index, mf: *const MappedFile) bool {497 pub fn hasMoved(ni: Node.Index, mf: *const MappedFile) bool {
498 var parent_ni = ni;498 var cur_ni = ni;
499 while (parent_ni != .root) {499 while (cur_ni != .root) {
500 const parent_node = parent_ni.get(mf);500 if (cur_ni.get(mf).flags.moved) return true;
501 if (!parent_node.flags.bubbles_moved) break;501 const parent_ni = cur_ni.parent(mf).unwrap().?;
502 if (parent_node.flags.moved) return true;502 if (!parent_ni.get(mf).flags.bubbles_moved) break;
503 parent_ni = parent_node.parent.unwrap().?;503 cur_ni = parent_ni;
504 }504 }
505 return false;505 return false;
506 }506 }