insertRight method

ZipperLocation<ZR, ZI, ZS> insertRight(
  1. ZR r
)

Insert new node to the right

Implementation

ZipperLocation<ZR, ZI, ZS> insertRight(ZR r) {
  if (path is TopPath) {
    throw Exception("insert of top");
  }
  final p = path as NodePath<ZS, ZR>;
  return update(
    node: node,
    path: NodePath(
      left: p.left,
      parentPath: p.parentPath,
      parentNode: p.parentNode,
      right: List.unmodifiable([r, ...p.right]),
    ),
  );
}