The original function is not exported from rpart, but we require it to calculate the coordinates of leaves, segments and labels.
tree.depth(nodes)
Brian Ripley