step.motion.path.passes.merge

Merge pass — collapse adjacent same-type segments.

Two segments are merge-eligible if they share kind/axis/direction, both have known endpoints, and neither has a stop condition. SideAction and deferred-placeholder (None) entries act as merge barriers.

Classes

MergePass

Compiler pass that runs the merge transform.

Functions

can_merge(→ bool)

Return True if two adjacent known-endpoint segments can be merged.

merge_two(→ step.motion.path.ir.Segment)

Merge two compatible segments. Precondition: can_merge(a, b).

run_merge(→ list[step.motion.path.ir.PathNode | None])

Collapse adjacent same-type/same-direction segments with no conditions.

Module Contents

step.motion.path.passes.merge.can_merge(a: step.motion.path.ir.Segment, b: step.motion.path.ir.Segment) bool

Return True if two adjacent known-endpoint segments can be merged.

step.motion.path.passes.merge.merge_two(a: step.motion.path.ir.Segment, b: step.motion.path.ir.Segment) step.motion.path.ir.Segment

Merge two compatible segments. Precondition: can_merge(a, b).

step.motion.path.passes.merge.run_merge(nodes: list[step.motion.path.ir.PathNode | None]) list[step.motion.path.ir.PathNode | None]

Collapse adjacent same-type/same-direction segments with no conditions.

class step.motion.path.passes.merge.MergePass

Compiler pass that runs the merge transform.

name = 'merge'
run(nodes: list[step.motion.path.ir.PathNode | None]) list[step.motion.path.ir.PathNode | None]