| 317 | } |
| 318 | |
| 319 | func (n *node) replaceChild(label, tail byte, child *node) { |
| 320 | for i := 0; i < len(n.children[child.typ]); i++ { |
| 321 | if n.children[child.typ][i].label == label && n.children[child.typ][i].tail == tail { |
| 322 | n.children[child.typ][i] = child |
| 323 | n.children[child.typ][i].label = label |
| 324 | n.children[child.typ][i].tail = tail |
| 325 | return |
| 326 | } |
| 327 | } |
| 328 | panic("chi: replacing missing child") |
| 329 | } |
| 330 | |
| 331 | func (n *node) getEdge(ntyp nodeTyp, label, tail byte, prefix string) *node { |
| 332 | nds := n.children[ntyp] |