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-27 10:19:55+01:00
logc1456afca0aaf0e9e2cdb29865766d8e017b7f06
tree5ed5ff8249481ee46dd05a2d73c73e2af25882ce
parente7502d1474724335116751b87a2b0b0f78b43299
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 }