Skip to content

Commit 623c5dc

Browse files
committed
Refactor Sabre state into separately mutable components
This commit separates out the three logical components of the Sabre routing tracking into three separate structs, where each struct groups objects that have the same mutation tendency. The previous Sabre state stored its problem description, internal tracking, and output tracking altogether in the same flat structure. Those three components have different tendencies to mutate: the problem description never mutates, the internal tracking frequently does, and the output tracking only occasionally does and has a lifetime validity tied to that of the problem description. Putting them together made it impossible to call methods that mutated the state while passing an object that borrowed from the problem description, such as when recursing into control-flow operations, because the borrow checker could not validate it. This applied interface pressure to inline more into the same method, which made code-reuse of separate concerns harder.
1 parent 572045f commit 623c5dc

1 file changed

Lines changed: 149 additions & 145 deletions

File tree

  • crates/transpiler/src/passes/sabre

0 commit comments

Comments
 (0)